Class CompletionProposalAdapter
java.lang.Object
org.yakindu.base.xtext.utils.jface.fieldassist.CompletionProposalAdapter
- All Implemented Interfaces:
ICompletionListener
This is a stripped copy from
ContentProposalAdapter that delegates
the popup to a CompletionProposal managed by a
IContentAssistant.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanFlag that controls the printing of debug info. -
Constructor Summary
ConstructorsConstructorDescriptionCompletionProposalAdapter(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 givenIContentAssistant. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd the specified listener to the list of content proposal listeners that are notified when a content proposal popup is opened or closed.voidvoidchar[]Return the array of characters on which the popup is autoactivated.intSet the delay, in milliseconds, used before any autoactivation is triggered.Get the control on which the content proposal adapter is installed.booleanReturn a boolean indicating whether the receiver is enabled.booleanAnswers a boolean indicating whether the main proposal popup is open.protected voidOpen the proposal popup and display the proposals provided by the proposal provider.voidRemove the specified listener from the list of content proposal listeners that are notified when a content proposal popup is opened or closed.voidselectionChanged(ICompletionProposal proposal, boolean smartToggle) voidsetAutoActivationCharacters(char[] autoActivationCharacters) Set the array of characters that will trigger autoactivation of the popup.voidsetAutoActivationDelay(int delay) Set the delay, in milliseconds, used before autoactivation is triggered.voidsetEnabled(boolean enabled) Set the boolean flag that determines whether the adapter is enabled.
-
Field Details
-
DEBUG
public static final boolean DEBUGFlag 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
autoActivationCharactersis untested.- Parameters:
control-contentAssistant-keyStroke-autoActivationCharacters-
-
-
Method Details
-
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:
trueif the adapter is enabled, andfalseif 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 isnulland the keyStroke value isnull, 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 isnull, then only a specified keyStroke will invoke content proposal. If this parameter isnulland the keyStroke value isnull, 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-trueif the adapter is enabled and responding to user input,falseif it is ignoring user input.
-
addContentProposalListener
Add the specified listener to the list of content proposal listeners that are notified when a content proposal popup is opened or closed. -
removeContentProposalListener
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:
trueif the proposal popup is open, andfalseif it is not.- Since:
- 3.6
-
assistSessionStarted
- Specified by:
assistSessionStartedin interfaceICompletionListener
-
assistSessionEnded
- Specified by:
assistSessionEndedin interfaceICompletionListener
-
selectionChanged
- Specified by:
selectionChangedin interfaceICompletionListener
-