public abstract class AbstractRefactoringOperation
extends java.lang.Object
Constructor and Description |
---|
AbstractRefactoringOperation(org.eclipse.emf.transaction.TransactionalEditingDomain domain)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
addAffectedResource(org.eclipse.core.runtime.IAdaptable adaptable)
Adds an affected resource IAdaptable to the list of affected resources.
|
protected void |
addAffectedResource(org.eclipse.emf.ecore.resource.Resource resource)
Wraps a Resource in an IAdaptable object that can adapt to both IFile
and IResource and adds it to the list of affected resources.
|
void |
addFile(org.eclipse.core.resources.IFile file)
Wraps a IFile as an IAdaptable that adapts to IFile and IResource and
adds the adaptable to the list of affected resources.
|
void |
addResource(org.eclipse.emf.ecore.resource.Resource res)
Wraps a Resource as an IAdaptable that adapts to IFile and IResource and
adds the adaptable to the list of affected resources.
|
protected void |
clearAffectedResources()
Clears the list of affected resources.
|
protected abstract org.eclipse.core.runtime.IStatus |
complete(org.eclipse.core.runtime.IProgressMonitor monitor)
Implementors can perform final cleanup in this method.
|
org.eclipse.core.runtime.IAdaptable |
getAdaptable(org.eclipse.core.runtime.IAdaptable baseAdaptable)
Returns an IAdaptable that adapts to IFile and IResource given another
IAdaptable.
|
protected org.eclipse.core.runtime.IAdaptable[] |
getAffectedResources()
Returns an array of IAdaptable objects that can adapt to IResource and
IFile.
|
java.util.Map |
getChangeDeltaCollector()
Returns the Map of changes.
|
org.eclipse.emf.transaction.TransactionalEditingDomain |
getEditingDomain()
Returns the default TranactionalEditingDomain in which this refactoring
operation is to be run.
|
protected abstract java.lang.Object |
getUIShell()
Returns the Shell or null.
|
protected abstract org.eclipse.core.runtime.IStatus |
init(org.eclipse.core.runtime.IProgressMonitor monitor)
Implementors can perform initialization tasks in this method and return
Status.OK_STATUS to allow the refactoring to continue.
|
protected org.eclipse.core.runtime.IStatus |
performCM(org.eclipse.core.runtime.IProgressMonitor monitor)
Performs change management by performing
ResourcesPlugin.getWorkspace().validateEdit() on the list of affected
resources, and then filtering out files that are read only.
|
protected abstract org.eclipse.core.runtime.IStatus |
postCM(org.eclipse.core.runtime.IProgressMonitor monitor)
Implementors can perform any task that is to take place after the main
CM task.
|
protected abstract org.eclipse.core.runtime.IStatus |
preCM(org.eclipse.core.runtime.IProgressMonitor monitor)
Implementors can perform any task that is to take place before the main
CM task.
|
protected abstract org.eclipse.core.runtime.IStatus |
refactor(org.eclipse.core.runtime.IProgressMonitor monitor)
Implementors can perform the main refactoring task in this method.
|
protected boolean |
removeAffectedResource(org.eclipse.core.runtime.IAdaptable adaptable)
Remove an affected resource IAdaptable from the list of affected
resources.
|
org.eclipse.core.runtime.IStatus |
run(org.eclipse.core.runtime.IProgressMonitor monitor)
Runs the refactoring
The run() method performs these tasks in the order below.
|
protected org.eclipse.core.runtime.IStatus |
save(org.eclipse.core.runtime.IProgressMonitor monitor)
Saves only the affected resources that need to be saved.
|
protected org.eclipse.core.runtime.IStatus |
save(org.eclipse.core.runtime.IProgressMonitor monitor,
boolean force)
Saves affected resources.
|
protected abstract org.eclipse.core.runtime.IStatus |
search(org.eclipse.core.runtime.IProgressMonitor monitor)
Implementors can perform the search task in this method and populate the
list of affected resources.
|
void |
setChangeDeltaCollector(java.util.Map changes)
Sets the Map of changes to the given Map.
|
public AbstractRefactoringOperation(org.eclipse.emf.transaction.TransactionalEditingDomain domain)
domain
- default TranactionalEditingDomain in which this refactoring
operation is to be run.public void setChangeDeltaCollector(java.util.Map changes)
changes
- Map of changespublic java.util.Map getChangeDeltaCollector()
public final org.eclipse.emf.transaction.TransactionalEditingDomain getEditingDomain()
protected org.eclipse.core.runtime.IAdaptable[] getAffectedResources()
protected boolean removeAffectedResource(org.eclipse.core.runtime.IAdaptable adaptable)
adaptable
- to remove from the list of affected resourcesprotected boolean addAffectedResource(org.eclipse.core.runtime.IAdaptable adaptable)
adaptable
- to add to the list of affected resources.protected void clearAffectedResources()
protected void addAffectedResource(org.eclipse.emf.ecore.resource.Resource resource)
public final org.eclipse.core.runtime.IStatus run(org.eclipse.core.runtime.IProgressMonitor monitor)
monitor
- IProgressMonitor used by the individual tasks.protected abstract org.eclipse.core.runtime.IStatus init(org.eclipse.core.runtime.IProgressMonitor monitor)
monitor
- IProgressMonitorprotected abstract org.eclipse.core.runtime.IStatus search(org.eclipse.core.runtime.IProgressMonitor monitor)
monitor
- IProgressMonitorprotected abstract org.eclipse.core.runtime.IStatus preCM(org.eclipse.core.runtime.IProgressMonitor monitor)
monitor
- IProgressMonitorprotected abstract org.eclipse.core.runtime.IStatus postCM(org.eclipse.core.runtime.IProgressMonitor monitor)
monitor
- IProgressMonitorprotected abstract org.eclipse.core.runtime.IStatus refactor(org.eclipse.core.runtime.IProgressMonitor monitor)
monitor
- IProgressMonitorprotected abstract org.eclipse.core.runtime.IStatus complete(org.eclipse.core.runtime.IProgressMonitor monitor)
monitor
- IProgressMonitorprotected abstract java.lang.Object getUIShell()
protected org.eclipse.core.runtime.IStatus performCM(org.eclipse.core.runtime.IProgressMonitor monitor)
monitor
- IProgressMonitorprotected org.eclipse.core.runtime.IStatus save(org.eclipse.core.runtime.IProgressMonitor monitor)
monitor
- IProgressMonitorprotected org.eclipse.core.runtime.IStatus save(org.eclipse.core.runtime.IProgressMonitor monitor, boolean force)
monitor
- IProgressMonitorforce
- true to force resaving resources that do not need to be
saved, false to only save the resources that need to be saved.public void addResource(org.eclipse.emf.ecore.resource.Resource res)
res
- Resource to addpublic void addFile(org.eclipse.core.resources.IFile file)
file
- IFile to addpublic org.eclipse.core.runtime.IAdaptable getAdaptable(org.eclipse.core.runtime.IAdaptable baseAdaptable)
baseAdaptable
- IAdaptable that will be wrapped.