Eclipse Platform
Release 3.2

org.eclipse.jface.text.quickassist
Interface IQuickAssistAssistant

All Known Implementing Classes:
QuickAssistAssistant

public interface IQuickAssistAssistant

An IQuickAssistAssistant provides support for quick fixes and quick assists. The quick assist assistant is a ISourceViewer add-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 IQuickAssistProcessor which provides the possible quick assist and quick fix completions.

The interface can be implemented by clients. By default, clients use QuickAssistAssistant as the standard implementer of this interface.

Since:
3.2
See Also:
ISourceViewer, IQuickAssistProcessor

Method Summary
 void addCompletionListener(ICompletionListener listener)
          Adds a completion listener that will be informed before proposals are computed.
 boolean canAssist(IQuickAssistInvocationContext invocationContext)
          Tells whether this assistant has assists for the given invocation context.
 boolean canFix(Annotation annotation)
          Tells whether this assistant has a fix for the given annotation.
 IQuickAssistProcessor getQuickAssistProcessor()
          Returns the quick assist processor to be used for the given content type.
 void install(ISourceViewer sourceViewer)
          Installs quick assist support on the given source viewer.
 void removeCompletionListener(ICompletionListener listener)
          Removes a completion listener.
 void setInformationControlCreator(IInformationControlCreator creator)
          Sets the information control creator for the additional information control.
 void setProposalSelectorBackground(Color background)
          Sets the proposal selector's background color.
 void setProposalSelectorForeground(Color foreground)
          Sets the proposal's foreground color.
 void setQuickAssistProcessor(IQuickAssistProcessor processor)
          Registers a given quick assist processor for a particular content type.
 void setStatusLineVisible(boolean show)
          Enables displaying a status line below the proposal popup.
 void setStatusMessage(String message)
          Sets the caption message displayed at the bottom of the completion proposal popup.
 String showPossibleQuickAssists()
          Shows all possible quick fixes and quick assists at the viewer's cursor position.
 void uninstall()
          Uninstalls quick assist support from the source viewer it has previously be installed on.
 

Method Detail

install

public 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 sourceViewer also implements ISourceViewerExtension3.

Parameters:
sourceViewer - the source viewer on which quick assist will work

setInformationControlCreator

public 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

public void uninstall()
Uninstalls quick assist support from the source viewer it has previously be installed on.


showPossibleQuickAssists

public 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

public 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, or null to remove an existing one

getQuickAssistProcessor

public IQuickAssistProcessor getQuickAssistProcessor()
Returns the quick assist processor to be used for the given content type.

Returns:
the quick assist processor or null if none exists

canFix

public 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 true even though there might be no quick fix.

Parameters:
annotation - the annotation
Returns:
true if the assistant has a fix for the given annotation

canAssist

public boolean canAssist(IQuickAssistInvocationContext invocationContext)
Tells whether this assistant has assists for the given invocation context.

Parameters:
invocationContext - the invocation context
Returns:
true if the assistant has a fix for the given annotation

setProposalSelectorBackground

public void setProposalSelectorBackground(Color background)
Sets the proposal selector's background color.

Parameters:
background - the background color

setProposalSelectorForeground

public void setProposalSelectorForeground(Color foreground)
Sets the proposal's foreground color.

Parameters:
foreground - the foreground color

addCompletionListener

public void addCompletionListener(ICompletionListener listener)
Adds a completion listener that will be informed before proposals are computed.

Parameters:
listener - the listener

removeCompletionListener

public void removeCompletionListener(ICompletionListener listener)
Removes a completion listener.

Parameters:
listener - the listener to remove

setStatusLineVisible

public 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 via setStatusMessage(String).

Parameters:
show - true to show a message line, false to not show one.

setStatusMessage

public void setStatusMessage(String message)
Sets the caption message displayed at the bottom of the completion proposal popup.

Parameters:
message - the message

Eclipse Platform
Release 3.2

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.