org.aspectj.org.eclipse.jdt.internal.core
Class SortElementsOperation

java.lang.Object
  extended by org.aspectj.org.eclipse.jdt.internal.core.JavaModelOperation
      extended by org.aspectj.org.eclipse.jdt.internal.core.SortElementsOperation

public class SortElementsOperation
extends JavaModelOperation

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
static java.lang.String CONTAINS_MALFORMED_NODES
           
 
Fields 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, TRUE
 
Constructor Summary
SortElementsOperation(int level, IJavaElement[] elements, int[] positions, java.util.Comparator comparator)
          Constructor for SortElementsOperation.
 
Method Summary
 TextEdit calculateEdit(CompilationUnit unit, TextEditGroup group)
          Calculates the required text edits to sort the unit
protected  void executeOperation()
          Performs the operation specific behavior.
protected  int getMainAmountOfWork()
          Returns the amount of work for the main task of this operation for progress reporting.
static void insert(TextEdit parent, TextEdit edit)
           
protected  boolean isMalformed(ASTNode node)
           
 IJavaModelStatus verify()
          Possible failures: NO_ELEMENTS_TO_PROCESS - the compilation unit supplied to the operation is null.
 
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, 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, worked
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTAINS_MALFORMED_NODES

public static final java.lang.String CONTAINS_MALFORMED_NODES
See Also:
Constant Field Values
Constructor Detail

SortElementsOperation

public SortElementsOperation(int level,
                             IJavaElement[] elements,
                             int[] positions,
                             java.util.Comparator comparator)
Constructor for SortElementsOperation.

Parameters:
level - the AST API level; one of the AST LEVEL constants
elements -
positions -
comparator -
Method Detail

getMainAmountOfWork

protected int getMainAmountOfWork()
Returns the amount of work for the main task of this operation for progress reporting.


isMalformed

protected boolean isMalformed(ASTNode node)

executeOperation

protected void executeOperation()
                         throws JavaModelException
Description copied from class: JavaModelOperation
Performs the operation specific behavior. Subclasses must override.

Specified by:
executeOperation in class JavaModelOperation
Throws:
JavaModelException
See Also:
JavaModelOperation.executeOperation()

calculateEdit

public TextEdit calculateEdit(CompilationUnit unit,
                              TextEditGroup group)
                       throws JavaModelException
Calculates the required text edits to sort the unit

Parameters:
group -
Returns:
the edit or null if no sorting is required
Throws:
JavaModelException

verify

public IJavaModelStatus verify()
Possible failures:

Overrides:
verify in class JavaModelOperation
Returns:
IJavaModelStatus
See Also:
IJavaModelStatus

insert

public static void insert(TextEdit parent,
                          TextEdit edit)