Interface IInvocationContext

All Superinterfaces:
org.eclipse.jdt.internal.ui.text.correction.IInvocationContextCore

public interface IInvocationContext extends org.eclipse.jdt.internal.ui.text.correction.IInvocationContextCore
Context information for quick fix and quick assist processors.

Note: this interface is not intended to be implemented.

Since:
3.0
Restriction:
This interface is not intended to be implemented by clients.
Restriction:
This interface is not intended to be extended by clients.
  • Method Details

    • getCompilationUnit

      ICompilationUnit getCompilationUnit()
      Specified by:
      getCompilationUnit in interface org.eclipse.jdt.internal.ui.text.correction.IInvocationContextCore
      Returns:
      the current compilation unit
    • getSelectionOffset

      int getSelectionOffset()
      Specified by:
      getSelectionOffset in interface org.eclipse.jdt.internal.ui.text.correction.IInvocationContextCore
      Returns:
      the offset of the current selection
    • getSelectionLength

      int getSelectionLength()
      Specified by:
      getSelectionLength in interface org.eclipse.jdt.internal.ui.text.correction.IInvocationContextCore
      Returns:
      the length of the current selection
    • getASTRoot

      CompilationUnit getASTRoot()
      Returns an AST of the compilation unit, possibly only a partial AST focused on the selection offset (see ASTParser.setFocalPosition(int)). The returned AST is shared and therefore protected and cannot be modified. The client must check the AST API level and do nothing if they are given an AST they can't handle.
      Specified by:
      getASTRoot in interface org.eclipse.jdt.internal.ui.text.correction.IInvocationContextCore
      Returns:
      the root of the AST corresponding to the current compilation unit
      See Also:
    • getCoveredNode

      ASTNode getCoveredNode()
      If the AST contains nodes whose range is equal to the selection, returns the innermost of those nodes. Otherwise, returns the first node in a preorder traversal of the AST, where the complete node range is covered by the selection.
      Specified by:
      getCoveredNode in interface org.eclipse.jdt.internal.ui.text.correction.IInvocationContextCore
      Returns:
      the covered node, or null if the selection is empty or too short to cover an entire node
    • getCoveringNode

      ASTNode getCoveringNode()
      Returns the innermost node that fully contains the selection. A node also contains the zero-length selection on either end.

      If more than one node covers the selection, the returned node is the last covering node found in a preorder traversal of the AST. This implies that for a zero-length selection between two adjacent sibling nodes, the node on the right is returned.

      Specified by:
      getCoveringNode in interface org.eclipse.jdt.internal.ui.text.correction.IInvocationContextCore
      Returns:
      the covering node