Package org.eclipse.jface.text.quickassist

# Class QuickAssistAssistant

java.lang.Object
org.eclipse.jface.text.quickassist.QuickAssistAssistant

All Implemented Interfaces:
  `IQuickAssistAssistant`, `IQuickAssistAssistantExtension`

public class QuickAssistAssistant extends Object implements IQuickAssistAssistant, IQuickAssistAssistantExtension
Default implementation of `IQuickAssistAssistant`.

Since:
  3.2

## Constructor Summary

Constructors
Constructor
Description
`QuickAssistAssistant()`

## Method Summary

Modifier and Type
Method
Description
`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.
`void`
`enableColoredLabels(boolean isEnabled)`
Enables the support for colored labels in the proposal popup.
`final IHandler`
`getHandler(String commandId)`
Returns the handler for the given command identifier.
`IQuickAssistProcessor`
`getQuickAssistProcessor()`
Returns the quick assist processor to be used for the given content type.
`protected void`
`hide()`
Hides any open pop-ups.
`void`
`install(ISourceViewer sourceViewer)`
Installs quick assist support on the given source viewer.
`protected void`
`possibleCompletionsClosed()`
Callback to signal this quick assist assistant that the presentation of the possible completions has been stopped.
`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`
`setRestoreCompletionProposalSize(IDialogSettings dialogSettings)`
Tells this assistant to open the proposal popup with the size contained in the given dialog settings and to store the control's last valid size in the given dialog settings.
`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.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### QuickAssistAssistant

public QuickAssistAssistant()

## Method Details

### showPossibleQuickAssists

public String showPossibleQuickAssists()
Description copied from interface: `IQuickAssistAssistant`
Shows all possible quick fixes and quick assists at the viewer's cursor position.

Specified by:
  `showPossibleQuickAssists` in interface `IQuickAssistAssistant`
Returns:
  an optional error message if no proposals can be computed

### getQuickAssistProcessor

public IQuickAssistProcessor getQuickAssistProcessor()
Description copied from interface: `IQuickAssistAssistant`
Returns the quick assist processor to be used for the given content type.

Specified by:
  `getQuickAssistProcessor` in interface `IQuickAssistAssistant`
Returns:
  the quick assist processor or `null` if none exists

### setQuickAssistProcessor

public void setQuickAssistProcessor(IQuickAssistProcessor processor)
Description copied from interface: `IQuickAssistAssistant`
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.

Specified by:
  `setQuickAssistProcessor` in interface `IQuickAssistAssistant`
Parameters:
  `processor` - the quick assist processor to register, or `null` to remove an existing one

### canFix

public boolean canFix(Annotation annotation)
Description copied from interface: `IQuickAssistAssistant`
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.

Specified by:
  `canFix` in interface `IQuickAssistAssistant`
Parameters:
  `annotation` - the annotation
Returns:
  `true` if the assistant has a fix for the given annotation

### canAssist

public boolean canAssist(IQuickAssistInvocationContext invocationContext)
Description copied from interface: `IQuickAssistAssistant`
Tells whether this assistant has assists for the given invocation context.

Specified by:
  `canAssist` in interface `IQuickAssistAssistant`
Parameters:
  `invocationContext` - the invocation context
Returns:
  `true` if the assistant has a fix for the given annotation

### install

public void install(ISourceViewer sourceViewer)
Description copied from interface: `IQuickAssistAssistant`
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`.

Specified by:
  `install` in interface `IQuickAssistAssistant`
Parameters:
  `sourceViewer` - the source viewer on which quick assist will work

### setInformationControlCreator

public void setInformationControlCreator(IInformationControlCreator creator)
Description copied from interface: `IQuickAssistAssistant`
Sets the information control creator for the additional information control.

Specified by:
  `setInformationControlCreator` in interface `IQuickAssistAssistant`
Parameters:
  `creator` - the information control creator for the additional information control

### uninstall

public void uninstall()
Description copied from interface: `IQuickAssistAssistant`
Uninstalls quick assist support from the source viewer it has previously be installed on.

Specified by:
  `uninstall` in interface `IQuickAssistAssistant`

### setProposalSelectorBackground

public void setProposalSelectorBackground(Color background)
Description copied from interface: `IQuickAssistAssistant`
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`.

Specified by:
  `setProposalSelectorBackground` in interface `IQuickAssistAssistant`
Parameters:
  `background` - the background color

### setProposalSelectorForeground

public void setProposalSelectorForeground(Color foreground)
Description copied from interface: `IQuickAssistAssistant`
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`.

Specified by:
  `setProposalSelectorForeground` in interface `IQuickAssistAssistant`
Parameters:
  `foreground` - the foreground color

### setRestoreCompletionProposalSize

public void setRestoreCompletionProposalSize(IDialogSettings dialogSettings)
Tells this assistant to open the proposal popup with the size contained in the given dialog settings and to store the control's last valid size in the given dialog settings.

Note: This API is only valid if the information control implements `IInformationControlExtension3`. Not following this restriction will later result in an `UnsupportedOperationException`.

The constants used to store the values are:

- `ContentAssistant.STORE_SIZE_X`
- `ContentAssistant.STORE_SIZE_Y`

Parameters:
  `dialogSettings` - the dialog settings
Since:
  3.7

### possibleCompletionsClosed

protected void possibleCompletionsClosed()
Callback to signal this quick assist assistant that the presentation of the possible completions has been stopped.

### addCompletionListener

public void addCompletionListener(ICompletionListener listener)
Description copied from interface: `IQuickAssistAssistant`
Adds a completion listener that will be informed before proposals are computed.

Specified by:
  `addCompletionListener` in interface `IQuickAssistAssistant`
Parameters:
  `listener` - the listener

### removeCompletionListener

public void removeCompletionListener(ICompletionListener listener)
Description copied from interface: `IQuickAssistAssistant`
Removes a completion listener.

Specified by:
  `removeCompletionListener` in interface `IQuickAssistAssistant`
Parameters:
  `listener` - the listener to remove

### setStatusLineVisible

public void setStatusLineVisible(boolean show)
Description copied from interface: `IQuickAssistAssistant`
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 `IQuickAssistAssistant.setStatusMessage(String)`.

Specified by:
  `setStatusLineVisible` in interface `IQuickAssistAssistant`
Parameters:
  `show` - `true` to show a message line, `false` to not show one.

### setStatusMessage

public void setStatusMessage(String message)
Description copied from interface: `IQuickAssistAssistant`
Sets the caption message displayed at the bottom of the completion proposal popup.

Specified by:
  `setStatusMessage` in interface `IQuickAssistAssistant`
Parameters:
  `message` - the message

### getHandler

public final IHandler getHandler(String commandId)
Returns the handler for the given command identifier.

The same handler instance will be returned when called a more than once with the same command identifier.

Specified by:
  `getHandler` in interface `IQuickAssistAssistantExtension`
Parameters:
  `commandId` - the command identifier
Returns:
  the handler for the given command identifier
Since:
  3.4

### hide

protected void hide()
Hides any open pop-ups.

Since:
  3.4

### enableColoredLabels

public void enableColoredLabels(boolean isEnabled)
Enables the support for colored labels in the proposal popup.

Completion proposals can implement `ICompletionProposalExtension6` to provide colored proposal labels.

Specified by:
  `enableColoredLabels` in interface `IQuickAssistAssistantExtension`
Parameters:
  `isEnabled` - if `true` the support for colored labels is enabled in the proposal popup
Since:
  3.4