KickJava   Java API By Example, From Geeks To Geeks.

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


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.IMethod;
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.tc.aspectwerkz.reflect.MethodInfo;
15 import com.terracottatech.config.TcConfigDocument.TcConfig;
16
17 public class DeleteMethodChange extends Change {
18   private IMethod fMethod;
19   private MethodInfo fMethodInfo;
20     
21   public DeleteMethodChange(IMethod method, MethodInfo methodInfo) {
22     super();
23     
24     fMethod = method;
25     fMethodInfo = methodInfo;
26   }
27   
28   public Object JavaDoc getModifiedElement() {
29     return null;
30   }
31   
32   public String JavaDoc getName() {
33     return "TCDeleteMethodConfigUpdate";
34   }
35   
36   public void initializeValidationData(IProgressMonitor pm) {/**/}
37   
38   public RefactoringStatus isValid(IProgressMonitor pm)
39     throws OperationCanceledException
40   {
41     return new RefactoringStatus();
42   }
43   
44   public Change perform(IProgressMonitor pm) {
45     TcPlugin plugin = TcPlugin.getDefault();
46     IProject project = fMethod.getJavaProject().getProject();
47     TcConfig config = (TcConfig)plugin.getConfiguration(project).copy();
48     
49     plugin.getConfigurationHelper(project).ensureNotLocked(fMethodInfo);
50     
51     // create the undo change
52
return new ConfigUndoneChange(project, config);
53   }
54 }
55
Popular Tags