KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ltk > core > refactoring > NullChange


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ltk.core.refactoring;
12
13 import org.eclipse.core.runtime.Assert;
14 import org.eclipse.core.runtime.CoreException;
15 import org.eclipse.core.runtime.IProgressMonitor;
16
17 import org.eclipse.ltk.internal.core.refactoring.RefactoringCoreMessages;
18
19 /**
20  * A refactoring change that does nothing. The reverse change of a
21  * <code>NullChange</code> is a <code>NullChange</code>.
22  * <p>
23  * Note: this class is not intended to be extended by clients.
24  * </p>
25  *
26  * @since 3.0
27  */

28 public class NullChange extends Change {
29
30     private String JavaDoc fName;
31     
32     /**
33      * Creates a new <code>NullChange</code> with a default name.
34      */

35     public NullChange() {
36         this(RefactoringCoreMessages.NullChange_name);
37     }
38
39     /**
40      * Creates a new <code>NullChange</code> with the given name.
41      *
42      * @param name the human readable name of this change
43      */

44     public NullChange(String JavaDoc name) {
45         Assert.isNotNull(name);
46         fName= name;
47     }
48     
49     /**
50      * {@inheritDoc}
51      */

52     public String JavaDoc getName() {
53         return fName;
54     }
55     
56     /**
57      * {@inheritDoc}
58      */

59     public void initializeValidationData(IProgressMonitor pm) {
60         // do nothing
61
}
62
63     /**
64      * {@inheritDoc}
65      */

66     public RefactoringStatus isValid(IProgressMonitor pm) throws CoreException {
67         return new RefactoringStatus();
68     }
69     
70     /**
71      * {@inheritDoc}
72      */

73     public Change perform(IProgressMonitor pm) throws CoreException {
74         return new NullChange();
75     }
76
77     /**
78      * {@inheritDoc}
79      */

80     public Object JavaDoc getModifiedElement() {
81         return null;
82     }
83 }
84
Popular Tags