01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package org.terracotta.dso.refactoring;
05:
06: import org.eclipse.core.resources.IProject;
07: import org.eclipse.core.runtime.IProgressMonitor;
08: import org.eclipse.core.runtime.OperationCanceledException;
09: 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 getModifiedElement() {
29: return null;
30: }
31:
32: public String getName() {
33: return "TCDeleteMethodConfigUpdate";
34: }
35:
36: public void initializeValidationData(IProgressMonitor pm) {/**/
37: }
38:
39: public RefactoringStatus isValid(IProgressMonitor pm)
40: throws OperationCanceledException {
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)
48: .copy();
49:
50: plugin.getConfigurationHelper(project).ensureNotLocked(
51: fMethodInfo);
52:
53: // create the undo change
54: return new ConfigUndoneChange(project, config);
55: }
56: }
|