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

public class SortElementsOperation extends JavaModelOperation
This operation is used to sort elements in a compilation unit according to certain criteria.
Since:
2.1
  • Field Details

  • 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

      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:
      • invalid reference
        org.eclipse.jdt.internal.core.JavaModelOperation#executeOperation()
    • 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 the unit
      Returns:
      the edit or null if no sorting is required
      Throws:
      JavaModelException
    • verify

      public IJavaModelStatus 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:
      verify in class JavaModelOperation
      Returns:
      IJavaModelStatus
      See Also:
    • insert

      public static void insert(org.eclipse.text.edits.TextEdit parent, org.eclipse.text.edits.TextEdit edit)