Interface IQuickAssistAssistant
-
- All Known Implementing Classes:
QuickAssistAssistant
public interface IQuickAssistAssistantAnIQuickAssistAssistantprovides support for quick fixes and quick assists. The quick assist assistant is aISourceVieweradd-on. Its purpose is to propose, display, and insert quick assists and quick fixes available at the current source viewer's quick assist invocation context.The quick assist assistant can be configured with a
IQuickAssistProcessorwhich provides the possible quick assist and quick fix completions.In order to provide backward compatibility for clients of
IQuickAssistAssistant, extension interfaces are used to provide a means of evolution. The following extension interfaces exist:IQuickAssistAssistantExtensionsince version 3.4 introducing the following function:- allows to get a handler for the given command identifier
- allows to enable support for colored labels in the proposal popup
The interface can be implemented by clients. By default, clients use
QuickAssistAssistantas the standard implementer of this interface.- Since:
- 3.2
- See Also:
ISourceViewer,IQuickAssistProcessor,IQuickAssistAssistantExtension
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddCompletionListener(ICompletionListener listener)Adds a completion listener that will be informed before proposals are computed.booleancanAssist(IQuickAssistInvocationContext invocationContext)Tells whether this assistant has assists for the given invocation context.booleancanFix(Annotation annotation)Tells whether this assistant has a fix for the given annotation.IQuickAssistProcessorgetQuickAssistProcessor()Returns the quick assist processor to be used for the given content type.voidinstall(ISourceViewer sourceViewer)Installs quick assist support on the given source viewer.voidremoveCompletionListener(ICompletionListener listener)Removes a completion listener.voidsetInformationControlCreator(IInformationControlCreator creator)Sets the information control creator for the additional information control.voidsetProposalSelectorBackground(Color background)Sets the proposal selector's background color.voidsetProposalSelectorForeground(Color foreground)Sets the proposal's foreground color.voidsetQuickAssistProcessor(IQuickAssistProcessor processor)Registers a given quick assist processor for a particular content type.voidsetStatusLineVisible(boolean show)Enables displaying a status line below the proposal popup.voidsetStatusMessage(java.lang.String message)Sets the caption message displayed at the bottom of the completion proposal popup.java.lang.StringshowPossibleQuickAssists()Shows all possible quick fixes and quick assists at the viewer's cursor position.voiduninstall()Uninstalls quick assist support from the source viewer it has previously be installed on.
-
-
-
Method Detail
-
install
void install(ISourceViewer sourceViewer)
Installs quick assist support on the given source viewer.Note: This quick assist assistant will only be able to query the invocation context if
sourceVieweralso implementsISourceViewerExtension3.- Parameters:
sourceViewer- the source viewer on which quick assist will work
-
setInformationControlCreator
void setInformationControlCreator(IInformationControlCreator creator)
Sets the information control creator for the additional information control.- Parameters:
creator- the information control creator for the additional information control
-
uninstall
void uninstall()
Uninstalls quick assist support from the source viewer it has previously be installed on.
-
showPossibleQuickAssists
java.lang.String showPossibleQuickAssists()
Shows all possible quick fixes and quick assists at the viewer's cursor position.- Returns:
- an optional error message if no proposals can be computed
-
setQuickAssistProcessor
void setQuickAssistProcessor(IQuickAssistProcessor processor)
Registers a given quick assist processor for a particular content type. If there is already a processor registered, the new processor is registered instead of the old one.- Parameters:
processor- the quick assist processor to register, ornullto remove an existing one
-
getQuickAssistProcessor
IQuickAssistProcessor getQuickAssistProcessor()
Returns the quick assist processor to be used for the given content type.- Returns:
- the quick assist processor or
nullif none exists
-
canFix
boolean canFix(Annotation annotation)
Tells whether this assistant has a fix for the given annotation.Note: This test must be fast and optimistic i.e. it is OK to return
trueeven though there might be no quick fix.- Parameters:
annotation- the annotation- Returns:
trueif the assistant has a fix for the given annotation
-
canAssist
boolean canAssist(IQuickAssistInvocationContext invocationContext)
Tells whether this assistant has assists for the given invocation context.- Parameters:
invocationContext- the invocation context- Returns:
trueif the assistant has a fix for the given annotation
-
setProposalSelectorBackground
void setProposalSelectorBackground(Color background)
Sets the proposal selector's background color.Note: As of 3.4, you should only call this method if you want to override the
JFacePreferences.CONTENT_ASSIST_BACKGROUND_COLOR.- Parameters:
background- the background color
-
setProposalSelectorForeground
void setProposalSelectorForeground(Color foreground)
Sets the proposal's foreground color.Note: As of 3.4, you should only call this method if you want to override the
JFacePreferences.CONTENT_ASSIST_FOREGROUND_COLOR.- Parameters:
foreground- the foreground color
-
addCompletionListener
void addCompletionListener(ICompletionListener listener)
Adds a completion listener that will be informed before proposals are computed.- Parameters:
listener- the listener
-
removeCompletionListener
void removeCompletionListener(ICompletionListener listener)
Removes a completion listener.- Parameters:
listener- the listener to remove
-
setStatusLineVisible
void setStatusLineVisible(boolean show)
Enables displaying a status line below the proposal popup. The default is not to show the status line. The contents of the status line may be set viasetStatusMessage(String).- Parameters:
show-trueto show a message line,falseto not show one.
-
setStatusMessage
void setStatusMessage(java.lang.String message)
Sets the caption message displayed at the bottom of the completion proposal popup.- Parameters:
message- the message
-
-