1 11 package org.eclipse.ltk.core.refactoring.participants; 12 13 import org.eclipse.core.runtime.Assert; 14 import org.eclipse.core.runtime.CoreException; 15 import org.eclipse.core.runtime.IProgressMonitor; 16 import org.eclipse.core.runtime.OperationCanceledException; 17 import org.eclipse.core.runtime.PlatformObject; 18 19 import org.eclipse.ltk.core.refactoring.Change; 20 import org.eclipse.ltk.core.refactoring.RefactoringStatus; 21 import org.eclipse.ltk.core.refactoring.TextChange; 22 23 import org.eclipse.ltk.internal.core.refactoring.ParticipantDescriptor; 24 25 58 public abstract class RefactoringParticipant extends PlatformObject { 59 60 private RefactoringProcessor fProcessor; 61 62 private ParticipantDescriptor fDescriptor; 63 64 69 public RefactoringProcessor getProcessor() { 70 return fProcessor; 71 } 72 73 89 public boolean initialize(RefactoringProcessor processor, Object element, RefactoringArguments arguments) { 90 Assert.isNotNull(processor); 91 Assert.isNotNull(arguments); 92 fProcessor= processor; 93 initialize(arguments); 94 return initialize(element); 95 } 96 97 108 protected abstract boolean initialize(Object element); 109 110 115 protected abstract void initialize(RefactoringArguments arguments); 116 117 122 public abstract String getName(); 123 124 145 public abstract RefactoringStatus checkConditions(IProgressMonitor pm, CheckConditionsContext context) throws OperationCanceledException; 146 147 182 public abstract Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException; 183 184 198 public TextChange getTextChange(Object element) { 199 return getProcessor().getRefactoring().getTextChange(element); 200 } 201 202 204 void setDescriptor(ParticipantDescriptor descriptor) { 205 Assert.isNotNull(descriptor); 206 fDescriptor= descriptor; 207 } 208 209 ParticipantDescriptor getDescriptor() { 210 return fDescriptor; 211 } 212 } 213 | Popular Tags |