Class SortElementsOperation
java.lang.Object
org.aspectj.org.eclipse.jdt.internal.core.JavaModelOperation
org.aspectj.org.eclipse.jdt.internal.core.SortElementsOperation
- All Implemented Interfaces:
org.eclipse.core.resources.IWorkspaceRunnable,org.eclipse.core.runtime.ICoreRunnable,org.eclipse.core.runtime.IProgressMonitor
This operation is used to sort elements in a compilation unit according to
certain criteria.
- Since:
- 2.1
-
Nested Class Summary
Nested classes/interfaces inherited from class org.aspectj.org.eclipse.jdt.internal.core.JavaModelOperation
JavaModelOperation.IPostAction -
Field Summary
FieldsFields inherited from class org.aspectj.org.eclipse.jdt.internal.core.JavaModelOperation
actions, 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, TRUEFields inherited from interface org.eclipse.core.runtime.IProgressMonitor
UNKNOWN -
Constructor Summary
ConstructorsConstructorDescriptionSortElementsOperation(int level, IJavaElement[] elements, int[] positions, Comparator comparator) Constructor for SortElementsOperation. -
Method Summary
Modifier and TypeMethodDescriptionorg.eclipse.text.edits.TextEditcalculateEdit(CompilationUnit unit, org.eclipse.text.edits.TextEditGroup group) Calculates the required text edits to sort theunitprotected voidPerforms the operation specific behavior.protected intReturns the amount of work for the main task of this operation for progress reporting.static voidinsert(org.eclipse.text.edits.TextEdit parent, org.eclipse.text.edits.TextEdit edit) protected booleanisMalformed(ASTNode node) verify()Possible failures: NO_ELEMENTS_TO_PROCESS - the compilation unit supplied to the operation isnull. INVALID_ELEMENT_TYPES - the supplied elements are not an instance of IWorkingCopy.Methods inherited from class org.aspectj.org.eclipse.jdt.internal.core.JavaModelOperation
addAction, addDelta, addReconcileDelta, applyTextEdit, beginTask, canModifyRoots, checkCanceled, commonVerify, copyResources, createFile, createFolder, deleteEmptyPackageFragment, deleteResource, deleteResources, done, equalsOneOf, executeNestedOperation, firstActionWithID, getAttribute, getCompilationUnitFor, getCurrentOperationStack, getDocument, getElementToProcess, getJavaModel, getLatestASTLevel, getNestedFolders, getParentElement, getParentElements, getResultElements, getSchedulingRule, getSubProgressMonitor, hasModifiedResource, internalWorked, isCanceled, isReadOnly, isTopLevelOperation, moveResources, newJavaElementDelta, popOperation, postAction, prefixesOneOf, pushOperation, removeAllPostAction, removeReconcileDelta, run, runOperation, runPostActions, setAttribute, setCanceled, setNested, setTaskName, subTask, workedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.core.runtime.IProgressMonitor
clearBlocked, setBlocked, slice
-
Field Details
-
CONTAINS_MALFORMED_NODES
- See Also:
-
-
Constructor Details
-
SortElementsOperation
public SortElementsOperation(int level, IJavaElement[] elements, int[] positions, Comparator comparator) Constructor for SortElementsOperation.- Parameters:
level- the AST API level; one of the AST LEVEL constants
-
-
Method Details
-
getMainAmountOfWork
protected int getMainAmountOfWork()Returns the amount of work for the main task of this operation for progress reporting. -
isMalformed
-
executeOperation
Description copied from class:JavaModelOperationPerforms the operation specific behavior. Subclasses must override.- Specified by:
executeOperationin classJavaModelOperation- Throws:
JavaModelException- See Also:
-
calculateEdit
public org.eclipse.text.edits.TextEdit calculateEdit(CompilationUnit unit, org.eclipse.text.edits.TextEditGroup group) throws JavaModelException Calculates the required text edits to sort theunit- Returns:
- the edit or null if no sorting is required
- Throws:
JavaModelException
-
verify
Possible failures:- NO_ELEMENTS_TO_PROCESS - the compilation unit supplied to the operation is
null. - INVALID_ELEMENT_TYPES - the supplied elements are not an instance of IWorkingCopy.
- Overrides:
verifyin classJavaModelOperation- Returns:
- IJavaModelStatus
- See Also:
- NO_ELEMENTS_TO_PROCESS - the compilation unit supplied to the operation is
-
insert
public static void insert(org.eclipse.text.edits.TextEdit parent, org.eclipse.text.edits.TextEdit edit)
-