Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.ltk.core.refactoring
Class PerformChangeOperation

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

public class PerformChangeOperation
extends Object
implements 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() returns true) then the operation has called Change.dispose() as well to clear-up internal state in the change object. If it hasn't been executed the change, 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) to initialize the undo change's validation data.

If an undo manager has been set via the method setUndoManager(IUndoManager, String) 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
Restriction:
This class is not intended to be subclassed by clients.

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.
protected  void executeChange ( 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 ( IProgressMonitor pm)
          Runs the operation reporting progress to and accepting cancellation requests from the given progress monitor.
 void setSchedulingRule ( ISchedulingRule rule)
          Sets the scheduling rule used to execute this operation.
 void setUndoManager ( IUndoManager manager, String undoName)
          Sets the undo manager.
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PerformChangeOperation

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

Parameters:
change - the change to be applied to the workbench

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.

Parameters:
op - the CreateChangeOperation used to create the actual change object
Method Detail

changeExecutionFailed

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

Returns:
true if the change execution failed; false otherwise

changeExecuted

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

Returns:
true if the change has been executed, otherwise false

getConditionCheckingStatus

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

Returns:
the status of the condition checking

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.

Returns:
the change used by this operation or null if no change has been created

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.

Returns:
the undo change of the performed change or null

getValidationStatus

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

Returns:
the change's validation status

setUndoManager

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

Parameters:
manager - the undo manager to use or null if no undo recording is desired
undoName - the name used to present the undo change on the undo stack. Must be a human-readable string. Must not be null if manager is unequal null

setSchedulingRule

public void setSchedulingRule(
ISchedulingRule rule)
Sets the scheduling rule used to execute this operation. If not set then the workspace root is used. The Change operation must be able to be performed in the provided scheduling rule.

Parameters:
rule - the Rule to use, not null
Since:
3.3

run

public void run(
IProgressMonitor pm)
         throws 
CoreException
Runs the operation reporting progress to and accepting cancellation requests from the given progress monitor.

Implementors of this method should check the progress monitor for cancellation when it is safe and appropriate to do so. The cancellation request should be propagated to the caller by throwing OperationCanceledException.

Specified by:
run in interface IWorkspaceRunnable
Parameters:
pm - a progress monitor, or null if progress reporting and cancellation are not desired
Throws:
CoreException - if this operation fails.

executeChange

protected void executeChange(
IProgressMonitor pm)
                      throws 
CoreException
Actually executes the change.

Parameters:
pm - a progress monitor to report progress
Throws:
CoreException - if an unexpected error occurs during change execution

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire