Class AbstractProposalSorter

java.lang.Object
org.eclipse.jdt.ui.text.java.AbstractProposalSorter
All Implemented Interfaces:
Comparator<org.eclipse.jface.text.contentassist.ICompletionProposal>, org.eclipse.jface.text.contentassist.ICompletionProposalSorter

public abstract class AbstractProposalSorter extends Object implements Comparator<org.eclipse.jface.text.contentassist.ICompletionProposal>, org.eclipse.jface.text.contentassist.ICompletionProposalSorter
Abstract base class for sorters contributed to the org.eclipse.jdt.ui.javaCompletionProposalSorters extension point.

Subclasses need to implement compare(ICompletionProposal, ICompletionProposal) and may override beginSorting and endSorting.

The orderings imposed by a subclass need not be consistent with equals.

Since:
3.2
  • Constructor Details

    • AbstractProposalSorter

      protected AbstractProposalSorter()
      Creates a new sorter. Note that subclasses must provide a zero-argument constructor to be instantiatable via IConfigurationElement.createExecutableExtension(String).
  • Method Details

    • beginSorting

      public void beginSorting(ContentAssistInvocationContext context)
      Called once before initial sorting starts the first time.

      Note: As of 3.8 a completion proposal computer can request that proposals are resorted. If such a computer is active, then this method will not be called.

      Clients may override, the default implementation does nothing.

      Parameters:
      context - the context of the content assist invocation
    • compare

      public abstract int compare(org.eclipse.jface.text.contentassist.ICompletionProposal p1, org.eclipse.jface.text.contentassist.ICompletionProposal p2)
      The orderings imposed by an implementation need not be consistent with equals.
      Specified by:
      compare in interface Comparator<org.eclipse.jface.text.contentassist.ICompletionProposal>
      Specified by:
      compare in interface org.eclipse.jface.text.contentassist.ICompletionProposalSorter
      Parameters:
      p1 - the first proposal to be compared
      p2 - the second proposal to be compared
      Returns:
      a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second
      See Also:
    • endSorting

      public void endSorting()
      Called once after the initial sorting finished.

      Note: As of 3.8 a completion proposal computer can request that proposals are resorted. If such a computer is active, then this method will not be called.

      Clients may override, the default implementation does nothing.