Package org.eclipse.ui.ide.undo
Class CreateFolderOperation
java.lang.Object
org.eclipse.core.commands.operations.AbstractOperation
org.eclipse.ui.ide.undo.AbstractWorkspaceOperation
org.eclipse.ui.ide.undo.CreateFolderOperation
- All Implemented Interfaces:
- IAdvancedUndoableOperation,- IAdvancedUndoableOperation2,- IUndoableOperation
A CreateFolderOperation represents an undoable operation for creating a
 folder in the workspace. If a link location is specified, the folder is
 considered to be linked to the specified location. If a link location is not
 specified, the folder will be created in the location specified by the
 handle, and the entire containment path of the folder will be created if it
 does not exist.  The folder should not already exist, and the existence
 of the containment path should not be changed between the time this operation
 is created and the time it is executed.
 
Clients may call the public API from a background thread.
This class is intended to be instantiated and used by clients. It is not intended to be subclassed by clients.
- Since:
- 3.3
- Restriction:
- This class is not intended to be subclassed by clients.
- 
Field SummaryFieldsFields inherited from class org.eclipse.ui.ide.undo.AbstractWorkspaceOperationEXECUTE, quietCompute, REDO, resources, UNDO
- 
Constructor SummaryConstructorsConstructorDescriptionCreateFolderOperation(IFolder folderHandle, URI linkLocation, boolean virtual, UIResourceFilterDescription[] filterList, String label) Create a CreateFolderOperationCreateFolderOperation(IFolder folderHandle, URI linkLocation, String label) Create a CreateFolderOperation
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidAppend any descriptive text to the specified string buffer to be shown in the receiver'sAbstractWorkspaceOperation.toString()text.protected ISchedulingRuleCompute a scheduling rule for creating resources.protected IStatuscomputeCreateStatus(boolean allowOverwrite) Compute the status for creating resources from the descriptions.protected ISchedulingRuleCompute a scheduling rule for deleting resources.protected IStatusCompute the status for deleting resources.computeExecutionStatus(IProgressMonitor monitor) Return a status indicating the projected outcome of executing the receiver.computeRedoableStatus(IProgressMonitor monitor) Return a status indicating the projected outcome of redoing the receiver.computeUndoableStatus(IProgressMonitor monitor) Return a status indicating the projected outcome of undoing the receiver.protected voiddelete(IProgressMonitor monitor, IAdaptable uiInfo, boolean deleteContent) Delete any resources known by this operation.protected voiddoExecute(IProgressMonitor monitor, IAdaptable uiInfo) Perform the specific work involved in executing this operation.protected voiddoUndo(IProgressMonitor monitor, IAdaptable uiInfo) Perform the specific work involved in undoing this operation.protected ISchedulingRuleReturn a scheduling rule appropriate for executing this operation.protected ISchedulingRuleReturn a scheduling rule appropriate for undoing this operation.protected voidrecreate(IProgressMonitor monitor, IAdaptable uiInfo) Recreate any resources known by this operation.protected voidsetResourceDescriptions(IResourceSnapshot<? extends IResource>[] descriptions) Set the array of resource descriptions describing resources to be restored when undoing or redoing this operation.protected voidsetTargetResources(IResource[] targetResources) Set the resources which are affected by this operationprotected booleanupdateResourceChangeDescriptionFactory(IResourceChangeDescriptionFactory factory, int operation) Update the provided resource change description factory so it can generate a resource delta describing the result of an undo or redo.Methods inherited from class org.eclipse.ui.ide.undo.AbstractWorkspaceOperationaboutToNotify, canExecute, canRedo, canUndo, execute, getAffectedObjects, getErrorStatus, getRedoSchedulingRule, getShell, getWarningStatus, getWorkspace, getWorkspaceRuleFactory, isValid, markInvalid, redo, resourcesExist, resourcesIncludesProjects, runInBackground, setModelProviderIds, setQuietCompute, toString, undoMethods inherited from class org.eclipse.core.commands.operations.AbstractOperationaddContext, dispose, getContexts, getLabel, hasContext, removeContext, setLabel
- 
Field Details- 
resourceDescriptions
 
- 
- 
Constructor Details- 
CreateFolderOperationCreate a CreateFolderOperation- Parameters:
- folderHandle- the folder to be created
- linkLocation- the location of the folder if it is to be linked
- label- the label of the operation
 
- 
CreateFolderOperationpublic CreateFolderOperation(IFolder folderHandle, URI linkLocation, boolean virtual, UIResourceFilterDescription[] filterList, String label) Create a CreateFolderOperation- Parameters:
- folderHandle- the folder to be created
- linkLocation- the location of the folder if it is to be linked
- virtual- Create a virtual folder
- filterList- The filters to apply to the created folder
- label- the label of the operation
- Since:
- 3.6
 
 
- 
- 
Method Details- 
doExecuteDescription copied from class:AbstractWorkspaceOperationPerform the specific work involved in executing this operation.- Specified by:
- doExecutein class- AbstractWorkspaceOperation
- Parameters:
- monitor- the progress monitor to use for the operation
- uiInfo- the IAdaptable (or- null) provided by the caller in order to supply UI information for prompting the user if necessary. When this parameter is not- null, it contains an adapter for the org.eclipse.swt.widgets.Shell.class
- Throws:
- CoreException- propagates any CoreExceptions thrown from the resources API
 
- 
doUndoDescription copied from class:AbstractWorkspaceOperationPerform the specific work involved in undoing this operation.- Specified by:
- doUndoin class- AbstractWorkspaceOperation
- Parameters:
- monitor- the progress monitor to use for the operation
- uiInfo- the IAdaptable (or- null) provided by the caller in order to supply UI information for prompting the user if necessary. When this parameter is not- null, it contains an adapter for the org.eclipse.swt.widgets.Shell.class
- Throws:
- CoreException- propagates any CoreExceptions thrown from the resources API
 
- 
updateResourceChangeDescriptionFactoryprotected boolean updateResourceChangeDescriptionFactory(IResourceChangeDescriptionFactory factory, int operation) Description copied from class:AbstractWorkspaceOperationUpdate the provided resource change description factory so it can generate a resource delta describing the result of an undo or redo. Return a boolean indicating whether any update was done. The default implementation does not update the factory. Subclasses are expected to override this method to more specifically describe their modifications to the workspace.- Overrides:
- updateResourceChangeDescriptionFactoryin class- AbstractWorkspaceOperation
- Parameters:
- factory- the factory to update
- operation- an integer indicating whether the change is part of an execute, undo, or redo
- Returns:
- a boolean indicating whether the factory was updated.
 
- 
getExecuteSchedulingRuleDescription copied from class:AbstractWorkspaceOperationReturn a scheduling rule appropriate for executing this operation. The default implementation is to return a rule that locks out the entire workspace. Subclasses are encouraged to provide more specific rules that affect only their resources.- Overrides:
- getExecuteSchedulingRulein class- AbstractWorkspaceOperation
- Returns:
- the scheduling rule to use when executing this operation, or
         nullif there are no scheduling restrictions for this operation.
- See Also:
 
- 
getUndoSchedulingRuleDescription copied from class:AbstractWorkspaceOperationReturn a scheduling rule appropriate for undoing this operation. The default implementation is to return a rule that locks out the entire workspace. Subclasses are encouraged to provide more specific rules that affect only their resources.- Overrides:
- getUndoSchedulingRulein class- AbstractWorkspaceOperation
- Returns:
- the scheduling rule to use when undoing this operation, or
         nullif there are no scheduling restrictions for this operation.
- See Also:
 
- 
computeExecutionStatusDescription copied from class:AbstractWorkspaceOperationReturn a status indicating the projected outcome of executing the receiver. This method is not called by the operation history, but instead is used by clients (such as implementers ofIOperationApprover2) who wish to perform advanced validation of an operation before attempting to execute it. If an ERROR status is returned, the operation will not proceed and the user notified if deemed necessary by the caller. The validity flag on the operation should be marked as invalid. If an OK status is returned, the operation will proceed. The caller must interpret any other returned status severity, and may choose to prompt the user as to how to proceed. If there are multiple conditions that result in an ambiguous status severity, it is best for the implementor of this method to consult the user as to how to proceed for each one, and return an OK or ERROR status that accurately reflects the user's wishes, or to return a multi-status that accurately describes all of the issues at hand, so that the caller may potentially consult the user. (Note that the user should not be consulted at all if a client has calledAbstractWorkspaceOperation.setQuietCompute(boolean)with a value oftrue.) This implementation computes the validity of execution by computing the resource delta that would be generated on execution, and checking whether any registered model providers are affected by the operation.- Specified by:
- computeExecutionStatusin interface- IAdvancedUndoableOperation2
- Overrides:
- computeExecutionStatusin class- AbstractWorkspaceOperation
- Parameters:
- monitor- the progress monitor to be used for computing the status
- Returns:
- the status indicating the projected outcome of executing the receiver
- See Also:
 
- 
computeUndoableStatusDescription copied from class:AbstractWorkspaceOperationReturn a status indicating the projected outcome of undoing the receiver. This method is not called by the operation history, but instead is used by clients (such as implementers ofIOperationApprover2) who wish to perform advanced validation of an operation before attempting to undo it. If an ERROR status is returned, the undo will not proceed and the user notified if deemed necessary by the caller. The validity flag on the operation should be marked as invalid. If an OK status is returned, the undo will proceed. The caller must interpret any other returned status severity, and may choose to prompt the user as to how to proceed. If there are multiple conditions that result in an ambiguous status severity, it is best for the implementor of this method to consult the user as to how to proceed for each one, and return an OK or ERROR status that accurately reflects the user's wishes, or to return a multi-status that accurately describes all of the issues at hand, so that the caller may potentially consult the user. (Note that the user should not be consulted at all if a client has calledAbstractWorkspaceOperation.setQuietCompute(boolean)with a value oftrue.) This implementation computes the validity of undo by computing the resource delta that would be generated on undo, and checking whether any registered model providers are affected by the operation.- Specified by:
- computeUndoableStatusin interface- IAdvancedUndoableOperation
- Overrides:
- computeUndoableStatusin class- AbstractWorkspaceOperation
- Parameters:
- monitor- the progress monitor to be used for computing the status
- Returns:
- the status indicating the projected outcome of undoing the receiver
- See Also:
 
- 
computeRedoableStatusDescription copied from class:AbstractWorkspaceOperationReturn a status indicating the projected outcome of redoing the receiver. This method is not called by the operation history, but instead is used by clients (such as implementers ofIOperationApprover2) who wish to perform advanced validation of an operation before attempting to redo it. If an ERROR status is returned, the redo will not proceed and the user notified if deemed necessary by the caller. The validity flag on the operation should be marked as invalid. If an OK status is returned, the redo will proceed. The caller must interpret any other returned status severity, and may choose to prompt the user as to how to proceed. If there are multiple conditions that result in an ambiguous status severity, it is best for the implementor of this method to consult the user as to how to proceed for each one, and return an OK or ERROR status that accurately reflects the user's wishes, or to return a multi-status that accurately describes all of the issues at hand, so that the caller may potentially consult the user. (Note that the user should not be consulted at all if a client has calledAbstractWorkspaceOperation.setQuietCompute(boolean)with a value oftrue.) This implementation computes the validity of redo by computing the resource delta that would be generated on redo, and checking whether any registered model providers are affected by the operation.- Specified by:
- computeRedoableStatusin interface- IAdvancedUndoableOperation
- Overrides:
- computeRedoableStatusin class- AbstractWorkspaceOperation
- Parameters:
- monitor- the progress monitor to be used for computing the status
- Returns:
- the status indicating the projected outcome of redoing the receiver
- See Also:
 
- 
deleteprotected void delete(IProgressMonitor monitor, IAdaptable uiInfo, boolean deleteContent) throws CoreException Delete any resources known by this operation. Store enough information to undo and redo the operation.- Parameters:
- monitor- the progress monitor to use for the operation
- uiInfo- the IAdaptable (or- null) provided by the caller in order to supply UI information for prompting the user if necessary. When this parameter is not- null, it contains an adapter for the org.eclipse.swt.widgets.Shell.class
- deleteContent-- trueif the content of any known projects should be deleted along with the project.- falseif project content should not be deleted.
- Throws:
- CoreException- propagates any CoreExceptions thrown from the resources API
 
- 
recreateRecreate any resources known by this operation. Store enough information to undo and redo the operation.- Parameters:
- monitor- the progress monitor to use for the operation
- uiInfo- the IAdaptable (or- null) provided by the caller in order to supply UI information for prompting the user if necessary. When this parameter is not- null, it contains an adapter for the org.eclipse.swt.widgets.Shell.class
- Throws:
- CoreException- propagates any CoreExceptions thrown from the resources API
 
- 
computeCreateStatusCompute the status for creating resources from the descriptions. A status severity ofOKindicates that the create is likely to be successful. A status severity ofERRORindicates that the operation is no longer valid. Other status severities are open to interpretation by the caller. Note this method may be called on initial creation of a resource, or when a create or delete operation is being undone or redone. Therefore, this method should check conditions that can change over the life of the operation, such as the existence of the information needed to carry out the operation. One-time static checks should typically be done by the caller (such as the action that creates the operation) so that the user is not continually prompted or warned about conditions that were acceptable at the time of original execution.- Parameters:
- allowOverwrite- a boolean that specifies whether resource creation should be allowed to overwrite an existent resource.
 
- 
computeDeleteStatusCompute the status for deleting resources. A status severity ofOKindicates that the delete is likely to be successful. A status severity ofERRORindicates that the operation is no longer valid. Other status severities are open to interpretation by the caller. Note this method may be called on initial deletion of a resource, or when a create or delete operation is being undone or redone. Therefore, this method should check conditions that can change over the life of the operation, such as the existence of the resources to be deleted. One-time static checks should typically be done by the caller (such as the action that creates the operation) so that the user is not continually prompted or warned about conditions that were acceptable at the time of original execution.
- 
setResourceDescriptionsSet the array of resource descriptions describing resources to be restored when undoing or redoing this operation.- Parameters:
- descriptions- the array of resource descriptions
 
- 
appendDescriptiveTextDescription copied from class:AbstractWorkspaceOperationAppend any descriptive text to the specified string buffer to be shown in the receiver'sAbstractWorkspaceOperation.toString()text.Note that this method is not intend to be subclassed by clients. - Overrides:
- appendDescriptiveTextin class- AbstractWorkspaceOperation
- Parameters:
- text- the StringBuffer on which to append the text
 
- 
computeCreateSchedulingRuleCompute a scheduling rule for creating resources.- Returns:
- a scheduling rule appropriate for creating the resources specified in the resource descriptions
 
- 
computeDeleteSchedulingRuleCompute a scheduling rule for deleting resources.- Returns:
- a scheduling rule appropriate for deleting the resources specified in the receiver.
 
- 
setTargetResourcesDescription copied from class:AbstractWorkspaceOperationSet the resources which are affected by this operation- Overrides:
- setTargetResourcesin class- AbstractWorkspaceOperation
- Parameters:
- targetResources- an array of resources
 
 
-