Class CreateChangeOperation
- java.lang.Object
-
- org.eclipse.ltk.core.refactoring.CreateChangeOperation
-
- All Implemented Interfaces:
IWorkspaceRunnable,ICoreRunnable
public class CreateChangeOperation extends Object implements IWorkspaceRunnable
Operation that, when performed, creates aChangeobject for a given refactoring. If created with a refactoring object directly, no precondition checking is performed. If created with aCheckConditionsOperationthe requested precondition checking is performed before creating the change.If the precondition checking returns a fatal error or the status's severity exceeds a certain threshold then no change will be created.
If a change has been created the operation calls
Change.initializeValidationData(IProgressMonitor)to initialize the change's validation data.The operation should be executed via the run method offered by
IWorkspaceto achieve proper delta batching.Note: this class is not intended to be extended by clients.
- Since:
- 3.0
- Restriction:
- This class is not intended to be subclassed by clients.
-
-
Constructor Summary
Constructors Constructor Description CreateChangeOperation(CheckConditionsOperation operation, int checkFailedSeverity)Creates a new operation with the givenCheckConditionsOperation.CreateChangeOperation(Refactoring refactoring)Creates a new operation with the given refactoring.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ChangegetChange()Returns the outcome of the operation ornullif an exception occurred when performing the operation or the operation hasn't been performed yet.intgetConditionCheckingFailedSeverity()Returns the condition checking failed severity used by this operation.RefactoringStatusgetConditionCheckingStatus()Returns the status of the condition checking.intgetConditionCheckingStyle()Returns the condition checking style as set to theCheckConditionsOperation.voidrun(IProgressMonitor pm)Executes this runnable.
-
-
-
Constructor Detail
-
CreateChangeOperation
public CreateChangeOperation(Refactoring refactoring)
Creates a new operation with the given refactoring. No condition checking is performed before creating the change object. It is assumed that the condition checking has already been performed outside of this operation. The operation might fail if the precondition checking has not been performed yet.- Parameters:
refactoring- the refactoring for which the change is to be created
-
CreateChangeOperation
public CreateChangeOperation(CheckConditionsOperation operation, int checkFailedSeverity)
Creates a new operation with the givenCheckConditionsOperation. When performed the operation first checks the conditions as specified by theCheckConditionsOperation. Depending on the result of the condition checking a change object is created or not.- Parameters:
operation- the condition checking operationcheckFailedSeverity- the severity from which on the condition checking is interpreted as failed. The passed value must be greater thanRefactoringStatus.OKand less than or equalRefactoringStatus.FATAL. The standard value from which on a condition check should is to be interpreted as failed can be accessed viaRefactoringCore.getConditionCheckingFailedSeverity().
-
-
Method Detail
-
getConditionCheckingFailedSeverity
public int getConditionCheckingFailedSeverity()
Returns the condition checking failed severity used by this operation.- Returns:
- the condition checking failed severity
- See Also:
RefactoringStatus
-
run
public void run(IProgressMonitor pm) throws CoreException
Description copied from interface:ICoreRunnableExecutes this runnable.The provided monitor can be used to report progress and respond to cancellation. If the progress monitor has been canceled, the runnable should finish its execution at the earliest convenience and throw an
OperationCanceledException. ACoreExceptionwith a status of severityIStatus.CANCELhas the same effect as anOperationCanceledException.- Specified by:
runin interfaceICoreRunnable- Specified by:
runin interfaceIWorkspaceRunnable- Parameters:
pm- a progress monitor, ornullif progress reporting and cancellation are not desired. The monitor is only valid for the duration of the invocation of this method. Callers may callIProgressMonitor.done()after this method returns or throws an exception, but this is not strictly required.- Throws:
CoreException- if this operation fails
-
getChange
public Change getChange()
Returns the outcome of the operation ornullif an exception occurred when performing the operation or the operation hasn't been performed yet.- Returns:
- the created change or
null
-
getConditionCheckingStatus
public RefactoringStatus getConditionCheckingStatus()
Returns the status of the condition checking. Returnsnullif no condition checking has been requested.- Returns:
- the status of the condition checking
-
getConditionCheckingStyle
public int getConditionCheckingStyle()
Returns the condition checking style as set to theCheckConditionsOperation. If no condition checking operation is provided (e.g. the change is created directly by callingRefactoring.createChange(IProgressMonitor)thenCheckConditionsOperation.NONEis returned.- Returns:
- the condition checking style
-
-