1 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.IAdaptable; 16 import org.eclipse.core.runtime.IProgressMonitor; 17 import org.eclipse.core.runtime.OperationCanceledException; 18 import org.eclipse.core.runtime.Platform; 19 20 95 public abstract class Change implements IAdaptable { 96 97 private Change fParent; 98 private boolean fIsEnabled= true; 99 100 103 protected Change() { 104 } 105 106 125 public ChangeDescriptor getDescriptor() { 126 return null; 127 } 128 129 135 public abstract String getName(); 136 137 144 public boolean isEnabled() { 145 return fIsEnabled; 146 } 147 148 154 public void setEnabled(boolean enabled) { 155 fIsEnabled= enabled; 156 } 157 158 168 public final void setEnabledShallow(boolean enabled) { 169 fIsEnabled= enabled; 170 } 171 172 178 public Change getParent() { 179 return fParent; 180 } 181 182 189 void setParent(Change parent) { 190 if (parent != null) 191 Assert.isTrue(fParent == null); 192 fParent= parent; 193 } 194 195 218 public abstract void initializeValidationData(IProgressMonitor pm); 219 220 240 public abstract RefactoringStatus isValid(IProgressMonitor pm) throws CoreException, OperationCanceledException; 241 242 255 public abstract Change perform(IProgressMonitor pm) throws CoreException; 256 257 265 public void dispose() { 266 } 268 269 275 public abstract Object getModifiedElement(); 276 277 292 public Object [] getAffectedObjects() { 293 return null; 294 } 295 296 299 public Object getAdapter(Class adapter) { 300 Object result= Platform.getAdapterManager().getAdapter(this, adapter); 301 if (result != null) 302 return result; 303 if (fParent != null) 304 return fParent.getAdapter(adapter); 305 return null; 306 } 307 } 308 | Popular Tags |