Interface ICompletionProposalExtension2

All Known Implementing Classes:
TemplateProposal

public interface ICompletionProposalExtension2
Extends ICompletionProposal with the following functions:
  • handling of trigger characters with modifiers
  • visual indication for selection of a proposal
Since:
2.1
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    apply(ITextViewer viewer, char trigger, int stateMask, int offset)
    Applies the proposed completion to the given document.
    void
    selected(ITextViewer viewer, boolean smartToggle)
    Called when the proposal is selected.
    void
    Called when the proposal is unselected.
    boolean
    validate(IDocument document, int offset, DocumentEvent event)
    Requests the proposal to be validated with respect to the document event.
  • Method Details

    • apply

      void apply(ITextViewer viewer, char trigger, int stateMask, int offset)
      Applies the proposed completion to the given document. The insertion has been triggered by entering the given character with a modifier at the given offset. This method assumes that validate(IDocument, int, DocumentEvent) returns true if called for offset.
      Parameters:
      viewer - the text viewer into which to insert the proposed completion
      trigger - the trigger to apply the completion
      stateMask - the state mask of the modifiers
      offset - the offset at which the trigger has been activated
    • selected

      void selected(ITextViewer viewer, boolean smartToggle)
      Called when the proposal is selected.
      Parameters:
      viewer - the text viewer.
      smartToggle - the smart toggle key was pressed
    • unselected

      void unselected(ITextViewer viewer)
      Called when the proposal is unselected.
      Parameters:
      viewer - the text viewer.
    • validate

      boolean validate(IDocument document, int offset, DocumentEvent event)
      Requests the proposal to be validated with respect to the document event. If the proposal cannot be validated, the methods returns false. If the document event was null, only the caret offset was changed, but not the document. This method replaces ICompletionProposalExtension.isValidFor(IDocument, int)
      Parameters:
      document - the document
      offset - the caret offset
      event - the document event, may be null
      Returns:
      boolean