Class CompletionProposalAdapter

java.lang.Object
org.yakindu.base.xtext.utils.jface.fieldassist.CompletionProposalAdapter
All Implemented Interfaces:
ICompletionListener

public class CompletionProposalAdapter extends Object implements ICompletionListener
This is a stripped copy from ContentProposalAdapter that delegates the popup to a CompletionProposal managed by a IContentAssistant.
  • Field Details

    • DEBUG

      public static final boolean DEBUG
      Flag that controls the printing of debug info.
      See Also:
  • Constructor Details

    • CompletionProposalAdapter

      public CompletionProposalAdapter(Control control, IContentAssistant contentAssistant, KeyStroke keyStroke, char[] autoActivationCharacters)

      This adapter installs listener on the given control and delegates the completion proposal popup request to the given IContentAssistant.

      FIXME: Parameter autoActivationCharacters is untested.

      Parameters:
      control -
      contentAssistant -
      keyStroke -
      autoActivationCharacters -
  • Method Details

    • getControl

      public Control getControl()
      Get the control on which the content proposal adapter is installed.
      Returns:
      the control on which the proposal adapter is installed.
    • isEnabled

      public boolean isEnabled()
      Return a boolean indicating whether the receiver is enabled.
      Returns:
      true if the adapter is enabled, and false if it is not.
    • getAutoActivationCharacters

      public char[] getAutoActivationCharacters()
      Return the array of characters on which the popup is autoactivated.
      Returns:
      An array of characters that trigger auto-activation of content proposal. If specified, these characters will trigger auto-activation of the proposal popup, regardless of whether an explicit invocation keyStroke was specified. If this parameter is null, then only a specified keyStroke will invoke content proposal. If this value is null and the keyStroke value is null, then all alphanumeric characters will auto-activate content proposal.
    • setAutoActivationCharacters

      public void setAutoActivationCharacters(char[] autoActivationCharacters)
      Set the array of characters that will trigger autoactivation of the popup.
      Parameters:
      autoActivationCharacters - An array of characters that trigger auto-activation of content proposal. If specified, these characters will trigger auto-activation of the proposal popup, regardless of whether an explicit invocation keyStroke was specified. If this parameter is null, then only a specified keyStroke will invoke content proposal. If this parameter is null and the keyStroke value is null , then all alphanumeric characters will auto-activate content proposal.
    • getAutoActivationDelay

      public int getAutoActivationDelay()
      Set the delay, in milliseconds, used before any autoactivation is triggered.
      Returns:
      the time in milliseconds that will pass before a popup is automatically opened
    • setAutoActivationDelay

      public void setAutoActivationDelay(int delay)
      Set the delay, in milliseconds, used before autoactivation is triggered.
      Parameters:
      delay - the time in milliseconds that will pass before a popup is automatically opened
    • setEnabled

      public void setEnabled(boolean enabled)
      Set the boolean flag that determines whether the adapter is enabled.
      Parameters:
      enabled - true if the adapter is enabled and responding to user input, false if it is ignoring user input.
    • addContentProposalListener

      public void addContentProposalListener(ICompletionProposalListener listener)
      Add the specified listener to the list of content proposal listeners that are notified when a content proposal popup is opened or closed.
    • removeContentProposalListener

      public void removeContentProposalListener(ICompletionProposalListener listener)
      Remove the specified listener from the list of content proposal listeners that are notified when a content proposal popup is opened or closed.
    • openProposalPopup

      protected void openProposalPopup()
      Open the proposal popup and display the proposals provided by the proposal provider. This method returns immediately. That is, it does not wait for a proposal to be selected. This method is used by subclasses to explicitly invoke the opening of the popup. If there are no proposals to show, the popup will not open and a beep will be sounded.
    • isProposalPopupOpen

      public boolean isProposalPopupOpen()
      Answers a boolean indicating whether the main proposal popup is open.
      Returns:
      true if the proposal popup is open, and false if it is not.
      Since:
      3.6
    • assistSessionStarted

      public void assistSessionStarted(ContentAssistEvent event)
      Specified by:
      assistSessionStarted in interface ICompletionListener
    • assistSessionEnded

      public void assistSessionEnded(ContentAssistEvent event)
      Specified by:
      assistSessionEnded in interface ICompletionListener
    • selectionChanged

      public void selectionChanged(ICompletionProposal proposal, boolean smartToggle)
      Specified by:
      selectionChanged in interface ICompletionListener