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 fromContentProposalAdapter
that delegates the popup to aCompletionProposal
managed by aIContentAssistant
.
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
DEBUG
Flag 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 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.void
assistSessionEnded(ContentAssistEvent event)
void
assistSessionStarted(ContentAssistEvent event)
char[]
getAutoActivationCharacters()
Return the array of characters on which the popup is autoactivated.int
getAutoActivationDelay()
Set the delay, in milliseconds, used before any autoactivation is triggered.Control
getControl()
Get the control on which the content proposal adapter is installed.boolean
isEnabled()
Return a boolean indicating whether the receiver is enabled.boolean
isProposalPopupOpen()
Answers a boolean indicating whether the main proposal popup is open.protected void
openProposalPopup()
Open the proposal popup and display the proposals provided by the proposal provider.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.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 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
autoActivationCharacters
is 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:
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
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, andfalse
if it is not.- Since:
- 3.6
-
assistSessionStarted
public void assistSessionStarted(ContentAssistEvent event)
- Specified by:
assistSessionStarted
in interfaceICompletionListener
-
assistSessionEnded
public void assistSessionEnded(ContentAssistEvent event)
- Specified by:
assistSessionEnded
in interfaceICompletionListener
-
selectionChanged
public void selectionChanged(ICompletionProposal proposal, boolean smartToggle)
- Specified by:
selectionChanged
in interfaceICompletionListener
-
-