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
Modifier and TypeFieldDescriptionstatic final boolean
Flag that controls the printing of debug info. -
Constructor Summary
ConstructorDescriptionCompletionProposalAdapter
(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 TypeMethodDescriptionvoid
Add the specified listener to the list of content proposal listeners that are notified when a content proposal popup is opened or closed.void
void
char[]
Return the array of characters on which the popup is autoactivated.int
Set the delay, in milliseconds, used before any autoactivation is triggered.Get the control on which the content proposal adapter is installed.boolean
Return a boolean indicating whether the receiver is enabled.boolean
Answers a boolean indicating whether the main proposal popup is open.protected void
Open the proposal popup and display the proposals provided by the proposal provider.void
Remove the specified listener from the list of content proposal listeners that are notified when a content proposal popup is opened or closed.void
selectionChanged
(ICompletionProposal proposal, boolean smartToggle) void
setAutoActivationCharacters
(char[] autoActivationCharacters) Set the array of characters that will trigger autoactivation of the popup.void
setAutoActivationDelay
(int delay) Set the delay, in milliseconds, used before autoactivation is triggered.void
setEnabled
(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
autoActivationCharacters
is 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:
true
if the adapter is enabled, andfalse
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 isnull
and 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 isnull
and 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
-true
if the adapter is enabled and responding to user input,false
if 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:
true
if the proposal popup is open, andfalse
if it is not.- Since:
- 3.6
-
assistSessionStarted
- Specified by:
assistSessionStarted
in interfaceICompletionListener
-
assistSessionEnded
- Specified by:
assistSessionEnded
in interfaceICompletionListener
-
selectionChanged
- Specified by:
selectionChanged
in interfaceICompletionListener
-