public class DeleteElementsOperation extends MultiOperation
NOTE: This operation only deletes elements contained within leaf resources - that is, elements within compilation units. To delete a compilation unit or a package, etc (which have an actual resource), a DeleteResourcesOperation should be used.
JavaModelOperation.IPostAction| Modifier and Type | Field and Description |
|---|---|
protected java.util.Map |
childrenToRemove
The elements this operation processes grouped by compilation unit
|
protected ASTParser |
parser
The
ASTParser used to manipulate the source code of
ICompilationUnit. |
insertBeforeElements, newParents, renamings, renamingsListactions, actionsEnd, actionsStart, APPEND, attributes, elementsToProcess, force, HAS_MODIFIED_RESOURCE_ATTR, isNested, KEEP_EXISTING, NO_ELEMENTS, OPERATION_STACKS, parentElements, POST_ACTION_VERBOSE, progressMonitor, REMOVEALL_APPEND, resultElements, TRUE| Constructor and Description |
|---|
DeleteElementsOperation(IJavaElement[] elementsToDelete,
boolean force)
When executed, this operation will delete the given elements.
|
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.String |
getMainTaskName()
Returns the name to be used by the progress monitor.
|
protected ISchedulingRule |
getSchedulingRule() |
protected void |
groupElements()
Groups the elements to be processed by their compilation unit.
|
protected void |
processElement(IJavaElement element)
Deletes this element from its compilation unit.
|
protected void |
processElements()
Processes all the
IJavaElements in turn, collecting errors
and updating the progress monitor. |
protected void |
verify(IJavaElement element)
This method is called for each
IJavaElement before
processElement. |
error, executeOperation, getDestinationParent, getNewNameFor, isMove, isRename, setInsertBefore, setRenamings, verifyDestination, verifyRenaming, verifySiblingaddAction, addDelta, addReconcileDelta, applyTextEdit, beginTask, canModifyRoots, checkCanceled, commonVerify, copyResources, createFile, createFolder, deleteEmptyPackageFragment, deleteResource, deleteResources, done, equalsOneOf, executeNestedOperation, firstActionWithID, getAttribute, getCompilationUnitFor, getCurrentOperationStack, getDocument, getElementToProcess, getJavaModel, getNestedFolders, getParentElement, getParentElements, getResultElements, getSubProgressMonitor, hasModifiedResource, internalWorked, isCanceled, isReadOnly, isTopLevelOperation, moveResources, newJavaElementDelta, popOperation, postAction, prefixesOneOf, pushOperation, removeAllPostAction, removeReconcileDelta, run, runOperation, runPostActions, setAttribute, setCanceled, setNested, setTaskName, subTask, verify, workedprotected java.util.Map childrenToRemove
protected ASTParser parser
ASTParser used to manipulate the source code of
ICompilationUnit.public DeleteElementsOperation(IJavaElement[] elementsToDelete, boolean force)
null or empty, and must be contained within a
compilation unit.protected java.lang.String getMainTaskName()
MultiOperationgetMainTaskName in class MultiOperationMultiOperationprotected ISchedulingRule getSchedulingRule()
getSchedulingRule in class JavaModelOperationprotected void groupElements()
throws JavaModelException
JavaModelExceptionprotected void processElement(IJavaElement element) throws JavaModelException
processElement in class MultiOperationJavaModelExceptionMultiOperationprotected void processElements()
throws JavaModelException
MultiOperationIJavaElements in turn, collecting errors
and updating the progress monitor.processElements in class MultiOperationJavaModelException - if one or several operation(s) was unable to
be completed.This method first group the elements by ICompilationUnit,
and then processes the ICompilationUnit.protected void verify(IJavaElement element) throws JavaModelException
MultiOperationIJavaElement before
processElement. It should check that this element
can be processed.verify in class MultiOperationJavaModelExceptionMultiOperation