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 fromContentProposalAdapterthat delegates the popup to aCompletionProposalmanaged by aIContentAssistant.
-
-
Field Summary
Fields Modifier and Type Field Description static booleanDEBUGFlag that controls the printing of debug info.
-
Constructor Summary
Constructors Constructor Description 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 givenIContentAssistant.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddContentProposalListener(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.voidassistSessionEnded(ContentAssistEvent event)voidassistSessionStarted(ContentAssistEvent event)char[]getAutoActivationCharacters()Return the array of characters on which the popup is autoactivated.intgetAutoActivationDelay()Set the delay, in milliseconds, used before any autoactivation is triggered.ControlgetControl()Get the control on which the content proposal adapter is installed.booleanisEnabled()Return a boolean indicating whether the receiver is enabled.booleanisProposalPopupOpen()Answers a boolean indicating whether the main proposal popup is open.protected voidopenProposalPopup()Open the proposal popup and display the proposals provided by the proposal provider.voidremoveContentProposalListener(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.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 Detail
-
DEBUG
public static final boolean DEBUG
Flag that controls the printing of debug info.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
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 Detail
-
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:
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
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:
trueif the proposal popup is open, andfalseif it is not.- Since:
- 3.6
-
assistSessionStarted
public void assistSessionStarted(ContentAssistEvent event)
- Specified by:
assistSessionStartedin interfaceICompletionListener
-
assistSessionEnded
public void assistSessionEnded(ContentAssistEvent event)
- Specified by:
assistSessionEndedin interfaceICompletionListener
-
selectionChanged
public void selectionChanged(ICompletionProposal proposal, boolean smartToggle)
- Specified by:
selectionChangedin interfaceICompletionListener
-
-