Package com.iizigo.editor.complex
Class ComplexOperation
java.lang.Object
org.eclipse.core.commands.operations.AbstractOperation
com.iizigo.editor.complex.ComplexOperation
- All Implemented Interfaces:
- IComplexOperation,- org.eclipse.core.commands.operations.IUndoableOperation
public class ComplexOperation extends org.eclipse.core.commands.operations.AbstractOperation implements IComplexOperation
The Complex operation can bundle advanced combination of operation between property containers. The operation is constructed with the property containers involved in the operation. Then the operation is executed. As it is executed, the undo/redo operations is built up.
- Author:
- Christopher Mindus
- Constructor SummaryConstructorsConstructorDescription- ComplexOperation- (String descr, IComplexOperationSelection selectionImpl, IPropUndoRedo undoRedo) Constructor of Add Operation.
- Method SummaryModifier and TypeMethodDescription- voidAdds a sub operation.- voidAdds a property.- void- addPropError- (GProp<?> gp, IPropErrorItem pei) Adds a property error.- booleanReturns whether the operation can be executed in its current state.- boolean- canRedo()Returns whether the operation can be redone in its current state.- boolean- canUndo()Returns whether the operation can be undone in its current state.- org.eclipse.core.runtime.IStatus- execute- (org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) Executes the Paste.Gets a container participant or creates one.Gets the global complex operation in progress.- booleanChecks if an operation has been performed successfully or if it's an empty operation for undo.- void- insertProp- (PropCnr pc, GProp<?> gp, int index) Inserts a property.- voidMoves a property to another container.- newContainerSelection- (GProp<?> prop) Creates a new ContainerSelection instance for a property container involved in the operation.- newContainerSelection- (PropCnr parent, Atom childAtom) Creates a new ContainerSelection instance for a property container involved in the operation.- org.eclipse.core.runtime.IStatus- redo- (org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) Redoes the Paste operation: same as Execute.- void- removeProp- (GProp<?> gp) Removes a property.- void- removePropError- (GProp<?> gp, String errorID) Removes a property error.- void- renameProp- (GProp<?> gp, Atom newName) Renames a property.- void- reorderProps- (PropCnr pc, Atom[] order) Reorder a property container.- booleanSets this operation as the current one for global operations.- void- setPropError- (GProp<?> gp, PropError pe) Sets all errors in a property.- void- setPropValue- (GProp<?> gp, Object newValue) Sets a property value.- void- setSelectionAfter- (ContainerSelection[] selection) Sets the selection after the operation has been performed so that it can be restored at a redo operation, before or after it has been executed.- void- setSelectionBefore- (ContainerSelection[] selection) Sets the selection before the operation has been performed so that it can be restored at a undo operation, before or after it has been executed.- org.eclipse.core.runtime.IStatus- undo- (org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) Performs the undo of a Paste operation.- booleanRemoves this operation as the current one for global operations.- Methods inherited from class org.eclipse.core.commands.operations.AbstractOperation- addContext, dispose, getContexts, getLabel, hasContext, removeContext, setLabel, toString
- Constructor Details- ComplexOperationpublic ComplexOperation- (String descr, IComplexOperationSelection selectionImpl, IPropUndoRedo undoRedo) Constructor of Add Operation.- Parameters:
- descr- Description of the operation.
- selectionImpl- Selection to set in the Viewer of "undoRedo" when operation completes (also for undo), null for none.
- undoRedo- The undo/redo provider, null for no undo/redo support.
 
 
- Method Details- getGlobalGets the global complex operation in progress.- Returns:
- The global operation, or null for none.
 
- setSelectionBeforeSets the selection before the operation has been performed so that it can be restored at a undo operation, before or after it has been executed.- Use the method - newContainerSelection(GProp)to create the array elements.- Parameters:
- selection- The selection.
 
- setSelectionAfterSets the selection after the operation has been performed so that it can be restored at a redo operation, before or after it has been executed.- Use the method - newContainerSelection(GProp)to create the array elements.- Parameters:
- selection- The selection.
 
- setPropValueSets a property value.- Specified by:
- setPropValuein interface- IComplexOperation
 
- addPropAdds a property.- Specified by:
- addPropin interface- IComplexOperation
 
- insertPropInserts a property.- Specified by:
- insertPropin interface- IComplexOperation
 
- removePropRemoves a property.- Specified by:
- removePropin interface- IComplexOperation
 
- renamePropRenames a property.- Specified by:
- renamePropin interface- IComplexOperation
 
- setPropErrorSets all errors in a property.- Specified by:
- setPropErrorin interface- IComplexOperation
 
- addPropErrorAdds a property error.- Specified by:
- addPropErrorin interface- IComplexOperation
 
- removePropErrorRemoves a property error.- Specified by:
- removePropErrorin interface- IComplexOperation
 
- movePropMoves a property to another container.- Specified by:
- movePropin interface- IComplexOperation
 
- reorderPropsReorder a property container.- Specified by:
- reorderPropsin interface- IComplexOperation
 
- hasPerformedAnOperationpublic boolean hasPerformedAnOperation()Checks if an operation has been performed successfully or if it's an empty operation for undo.- Specified by:
- hasPerformedAnOperationin interface- IComplexOperation
 
- getContainerParticipantGets a container participant or creates one.- Parameters:
- pc- The property container.
- Returns:
- The container participant.
 
- newContainerSelectionCreates a new ContainerSelection instance for a property container involved in the operation.- Parameters:
- prop- A selected property.
- Returns:
- The ContainerSelection instance.
 
- newContainerSelectionCreates a new ContainerSelection instance for a property container involved in the operation.- Parameters:
- parent- The parent of the selected property.
- childAtom- The atom of the selected property.
- Returns:
- The ContainerSelection instance.
 
- addOperationAdds a sub operation.
- canExecutepublic boolean canExecute()Returns whether the operation can be executed in its current state.- Specified by:
- canExecutein interface- org.eclipse.core.commands.operations.IUndoableOperation
- Overrides:
- canExecutein class- org.eclipse.core.commands.operations.AbstractOperation
 
- executepublic org.eclipse.core.runtime.IStatus execute- (org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException Executes the Paste.- Specified by:
- executein interface- org.eclipse.core.commands.operations.IUndoableOperation
- Specified by:
- executein class- org.eclipse.core.commands.operations.AbstractOperation
- Throws:
- org.eclipse.core.commands.ExecutionException
 
- canRedopublic boolean canRedo()Returns whether the operation can be redone in its current state.- Specified by:
- canRedoin interface- org.eclipse.core.commands.operations.IUndoableOperation
- Overrides:
- canRedoin class- org.eclipse.core.commands.operations.AbstractOperation
 
- redopublic org.eclipse.core.runtime.IStatus redo- (org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException Redoes the Paste operation: same as Execute.- Specified by:
- redoin interface- org.eclipse.core.commands.operations.IUndoableOperation
- Specified by:
- redoin class- org.eclipse.core.commands.operations.AbstractOperation
- Throws:
- org.eclipse.core.commands.ExecutionException
 
- canUndopublic boolean canUndo()Returns whether the operation can be undone in its current state.- Specified by:
- canUndoin interface- org.eclipse.core.commands.operations.IUndoableOperation
- Overrides:
- canUndoin class- org.eclipse.core.commands.operations.AbstractOperation
 
- undopublic org.eclipse.core.runtime.IStatus undo- (org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException Performs the undo of a Paste operation.- Specified by:
- undoin interface- org.eclipse.core.commands.operations.IUndoableOperation
- Specified by:
- undoin class- org.eclipse.core.commands.operations.AbstractOperation
- Throws:
- org.eclipse.core.commands.ExecutionException
 
- setGlobalpublic boolean setGlobal()Sets this operation as the current one for global operations.- Returns:
- true for single global operation assigned, false if another one has been replaced.
 
- unsetGlobalpublic boolean unsetGlobal()Removes this operation as the current one for global operations. If this operation is not the global one, nothing happens.- Returns:
- true for success, false if this operation was not the global one.