KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > terracotta > dso > refactoring > DeleteFieldChange


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package org.terracotta.dso.refactoring;
5
6 import org.eclipse.core.resources.IProject;
7 import org.eclipse.core.runtime.IProgressMonitor;
8 import org.eclipse.core.runtime.OperationCanceledException;
9 import org.eclipse.jdt.core.IField;
10 import org.eclipse.ltk.core.refactoring.Change;
11 import org.eclipse.ltk.core.refactoring.RefactoringStatus;
12
13 import org.terracotta.dso.TcPlugin;
14 import com.terracottatech.config.TcConfigDocument.TcConfig;
15
16 public class DeleteFieldChange extends Change {
17   private IField fField;
18     
19   public DeleteFieldChange(IField field) {
20     super();
21     fField = field;
22   }
23   
24   public Object JavaDoc getModifiedElement() {
25     return null;
26   }
27   
28   public String JavaDoc getName() {
29     return "TCDeleteFieldConfigUpdate";
30   }
31   
32   public void initializeValidationData(IProgressMonitor pm) {/**/}
33   
34   public RefactoringStatus isValid(IProgressMonitor pm)
35     throws OperationCanceledException
36   {
37     return new RefactoringStatus();
38   }
39   
40   public Change perform(IProgressMonitor pm) {
41     TcPlugin plugin = TcPlugin.getDefault();
42     IProject project = fField.getJavaProject().getProject();
43     TcConfig config = (TcConfig)plugin.getConfiguration(project).copy();
44     
45     plugin.getConfigurationHelper(project).ensureNotRoot(fField);
46     
47     // create the undo change
48
return new ConfigUndoneChange(project, config);
49   }
50 }
51
Popular Tags