Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.eclipse.ltk.core.refactoring
Class PerformChangeOperation  view PerformChangeOperation download PerformChangeOperation.java

java.lang.Object
  extended byorg.eclipse.ltk.core.refactoring.PerformChangeOperation
All Implemented Interfaces:
org.eclipse.core.resources.IWorkspaceRunnable

public class PerformChangeOperation
extends java.lang.Object
implements org.eclipse.core.resources.IWorkspaceRunnable

Operation that, when run, performs a Change object. The operation can be created in two different ways: with a given change or with a CreateChangeOperation. If created the second way the given create change operation will be used to create the actual change to perform.

If the change has been performed successfully (e.g. changeExecuted() 55 returns true) then the operation has called Change.dispose() 55 as well to clear-up internal state in the change object. If it hasn't been executed the change is still intact and the client is responsible to dispose the change object.

If an undo change has been provided by the change to execute then the operation calls Change.initializeValidationData(IProgressMonitor) 55 to initialize the undo change's validation data.

If an undo manager has been set via the method setUndoManager(IUndoManager, String) 55 then the undo object, if any has been provided, will be pushed onto the manager's undo stack.

The operation should be executed via the run method offered by IWorkspace to achieve proper delta batching.

Note: this class is not intended to be extended outside of the refactoring framework.

Since:
3.0

Field Summary
private  Change fChange
           
private  boolean fChangeExecuted
           
private  boolean fChangeExecutionFailed
           
private  CreateChangeOperation fCreateChangeOperation
           
private  Change fUndoChange
           
private  IUndoManager fUndoManager
           
private  java.lang.String fUndoName
           
private  RefactoringStatus fValidationStatus
           
 
Constructor Summary
PerformChangeOperation(Change change)
          Creates a new perform change operation instance for the given change.
PerformChangeOperation(CreateChangeOperation op)
          Creates a new PerformChangeOperation for the given CreateChangeOperation.
 
Method Summary
 boolean changeExecuted()
          Returns true if the change has been executed.
 boolean changeExecutionFailed()
          Returns true if the change execution failed.
private  boolean createChange()
           
protected  void executeChange(org.eclipse.core.runtime.IProgressMonitor pm)
          Actually executes the change.
 Change getChange()
          Returns the change used by this operation.
 RefactoringStatus getConditionCheckingStatus()
          Returns the status of the condition checking.
 Change getUndoChange()
          Returns the undo change of the change performed by this operation.
 RefactoringStatus getValidationStatus()
          Returns the refactoring status returned from the call IChange#isValid().
 void run(org.eclipse.core.runtime.IProgressMonitor pm)
          null
 void setUndoManager(IUndoManager manager, java.lang.String undoName)
          Sets the undo manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fChange

private Change fChange

fCreateChangeOperation

private CreateChangeOperation fCreateChangeOperation

fValidationStatus

private RefactoringStatus fValidationStatus

fUndoChange

private Change fUndoChange

fUndoName

private java.lang.String fUndoName

fUndoManager

private IUndoManager fUndoManager

fChangeExecuted

private boolean fChangeExecuted

fChangeExecutionFailed

private boolean fChangeExecutionFailed
Constructor Detail

PerformChangeOperation

public PerformChangeOperation(Change change)
Creates a new perform change operation instance for the given change.


PerformChangeOperation

public PerformChangeOperation(CreateChangeOperation op)
Creates a new PerformChangeOperation for the given CreateChangeOperation. The create change operation is used to create the actual change to execute.

Method Detail

changeExecutionFailed

public boolean changeExecutionFailed()
Returns true if the change execution failed.


changeExecuted

public boolean changeExecuted()
Returns true if the change has been executed. Otherwise false is returned.


getConditionCheckingStatus

public RefactoringStatus getConditionCheckingStatus()
Returns the status of the condition checking. Returns null if no condition checking has been requested.


getChange

public Change getChange()
Returns the change used by this operation. This is either the change passed to the constructor or the one create by the CreateChangeOperation. Method returns null if the create operation did not create a corresponding change or hasn't been executed yet.


getUndoChange

public Change getUndoChange()
Returns the undo change of the change performed by this operation. Returns null if the change hasn't been performed yet or if the change doesn't provide a undo.


getValidationStatus

public RefactoringStatus getValidationStatus()
Returns the refactoring status returned from the call IChange#isValid(). Returns null if the change has not been executed.


setUndoManager

public void setUndoManager(IUndoManager manager,
                           java.lang.String undoName)
Sets the undo manager. If the executed change provides an undo change, then the undo change is pushed onto this manager.


run

public void run(org.eclipse.core.runtime.IProgressMonitor pm)
         throws org.eclipse.core.runtime.CoreException
null

Specified by:
run in interface org.eclipse.core.resources.IWorkspaceRunnable

executeChange

protected void executeChange(org.eclipse.core.runtime.IProgressMonitor pm)
                      throws org.eclipse.core.runtime.CoreException
Actually executes the change.


createChange

private boolean createChange()