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.IField;
10: import org.eclipse.ltk.core.refactoring.Change;
11: import org.eclipse.ltk.core.refactoring.RefactoringStatus;
12:
13: import org.terracotta.dso.MultiChangeSignaller;
14: import org.terracotta.dso.TcPlugin;
15: import com.terracottatech.config.TcConfigDocument.TcConfig;
16:
17: public class BaseDeleteFieldChange extends Change {
18: private IField fField;
19:
20: public BaseDeleteFieldChange(IField field) {
21: super ();
22: fField = field;
23: }
24:
25: public Object getModifiedElement() {
26: return null;
27: }
28:
29: public String getName() {
30: return "TCBaseDeleteFieldConfigUpdate";
31: }
32:
33: public void initializeValidationData(IProgressMonitor pm) {/**/
34: }
35:
36: public RefactoringStatus isValid(IProgressMonitor pm)
37: throws OperationCanceledException {
38: return new RefactoringStatus();
39: }
40:
41: public Change perform(IProgressMonitor pm) {
42: TcPlugin plugin = TcPlugin.getDefault();
43: IProject project = fField.getJavaProject().getProject();
44: TcConfig config = (TcConfig) plugin.getConfiguration(project)
45: .copy();
46: MultiChangeSignaller signaller = new MultiChangeSignaller();
47:
48: plugin.getConfigurationHelper(project).baseEnsureNotRoot(
49: fField, signaller);
50: signaller.signal(project);
51:
52: // create the undo change
53: return new ConfigUndoneChange(project, config);
54: }
55: }
|