# Class FilteredTableBaseHandler

java.lang.Object
org.eclipse.core.commands.common.EventManager
org.eclipse.core.commands.AbstractHandler
org.eclipse.ui.internal.FilteredTableBaseHandler

All Implemented Interfaces:
  `IHandler, IHandler2, IExecutableExtension`

Direct Known Subclasses:
  `CycleEditorHandler, CyclePerspectiveHandler, CycleViewHandler, WorkbookEditorsHandler`

public abstract class FilteredTableBaseHandler extends AbstractHandler implements IExecutableExtension
Base class to open a dialog to filter and select elements of a `Table`.

Since:
  4.6.2
See Also:
  - and CycleBaseHandler

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static class`
`FilteredTableBaseHandler.FilteredTableItem`
Class used to store items to be displayed

## Field Summary

Fields
Modifier and Type
Field
Description
`protected ParameterizedCommand`
`commandBackward`
`protected ParameterizedCommand`
`commandForward`
`protected Shell`
`dialog`
`protected boolean`
`gotoDirection`
`protected WorkbenchPage`
`page`
`protected Object`
`result`
`protected IWorkbenchWindow`
`window`

## Constructor Summary

Constructors
Constructor
Description
`FilteredTableBaseHandler()`

## Method Summary

Modifier and Type
Method
Description
`protected void`
`activate(IWorkbenchPage page, Object selectedItem)`
Activate the selected item.
`protected void`
`addKeyListener(Table table, Shell dialog)`
Add Keylistener to the table, user actions can influence the dialog.
`protected void`
`addKeyListener(Text text)`
Add Key Listener to the search text. manage key events on search text
`protected void`
`addModifyListener(Text text)`
Add modify listener to the search text, trigger search each time text changes.
`protected void`
`addMouseListener(Table table, Shell dialog)`
Add mouse listener to the table closing it when the mouse is pressed.
`protected final void`
`addTraverseListener(Table table)`
Adds a listener to the given table that blocks all traversal operations.
`protected void`
`cancel(Shell dialog)`
Close the dialog and set selection to null.
`protected void`
`clearTriggers()`
Clears the forward and backward trigger sequences.
`Object`
`execute(ExecutionEvent event)`
Executes with the map of parameter values by name.
`protected Color`
`getBackground()`
`protected abstract ParameterizedCommand`
`getBackwardCommand()`
Get the backward command.
`TriggerSequence[]`
`getBackwardTriggerSequences()`
`protected ColumnLabelProvider`
`getColumnLabelProvider()`
Default ColumnLabelProvider.
`protected int`
`getCurrentItemIndex()`
Get the index of the current item (not valid if there are no items).
`protected ViewerFilter`
`getFilter()`
Return the filter to use.
`protected Color`
`getForeground()`
`protected abstract ParameterizedCommand`
`getForwardCommand()`
Get the forward command.
`TriggerSequence[]`
`getForwardTriggerSequences()`
`protected abstract Object`
`getInput(WorkbenchPage page)`
Add all items to the dialog in the activation order
`Object`
`getSelection()`
`protected String`
`getTableHeader(IWorkbenchPart activePart)`
Get TableHeader, return title for non-filtered lists.
`protected void`
`getTriggers()`
Fetch the key bindings for the forward and backward commands.
`IWorkbenchWindow`
`getWindow()`
`protected String`
`getWorkbenchPartReferenceText(WorkbenchPartReference ref)`
Returns the text for the given `WorkbenchPartReference`
`protected boolean`
`isFiltered()`
True to show search text and enable filtering.
`protected void`
`keepOpen(Display display, Shell dialog)`
Intended to be overwritten by test classes so the handler won't block the UI thread
`protected void`
`ok(Shell dialog, Table table)`
Close the dialog saving the selection
`void`
`openDialog(WorkbenchPage page, IWorkbenchPart activePart)`
`protected void`
`setDialogLocation(Shell dialog, IWorkbenchPart activePart)`
Sets the dialog's location on the screen.
`void`
`setInitializationData(IConfigurationElement config, String propertyName, Object data)`
This method is called by the implementation of the method `IConfigurationElement.createExecutableExtension` on a newly constructed extension, passing it its relevant configuration information.
`protected void`
`setLabelProvider(TableViewerColumn tableViewerColumn)`
Sets the label provider for the only column visible in the table.
`protected void`
`setMatcherString(String pattern)`
Set the filter text entered by the User, does nothing by default

### Methods inherited from class AbstractHandler

`addHandlerListener, dispose, fireHandlerChanged, hasListeners, isEnabled, isHandled, removeHandlerListener, setBaseEnabled, setEnabled`

### Methods inherited from class EventManager

`addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject`

### Methods inherited from class Object

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

### Methods inherited from interface IHandler

`getHandlerLabel`

## Field Details

### window

protected IWorkbenchWindow window

### page

protected WorkbenchPage page

### gotoDirection

protected boolean gotoDirection

### commandBackward

protected ParameterizedCommand commandBackward

### commandForward

protected ParameterizedCommand commandForward

### result

protected Object result

### dialog

protected Shell dialog

## Constructor Details

### FilteredTableBaseHandler

public FilteredTableBaseHandler()

## Method Details

### getCurrentItemIndex

protected int getCurrentItemIndex()
Get the index of the current item (not valid if there are no items).

### execute

public Object execute(ExecutionEvent event) throws ExecutionException
Description copied from interface: `IHandler`
Executes with the map of parameter values by name.

Specified by:
  `execute` in interface `IHandler`
Parameters:
  `event` - An event containing all the information about the current state of the application; must not be `null`.
Returns:
  the result of the execution. Reserved for future use, must be `null`.
Throws:
  `ExecutionException` - if an exception occurred during execution.

### openDialog

public void openDialog(WorkbenchPage page, IWorkbenchPart activePart)

### keepOpen

protected void keepOpen(Display display, Shell dialog)
Intended to be overwritten by test classes so the handler won't block the UI thread

### setDialogLocation

protected void setDialogLocation(Shell dialog, IWorkbenchPart activePart)
Sets the dialog's location on the screen.

### clearTriggers

protected void clearTriggers()
Clears the forward and backward trigger sequences.

### getTriggers

protected void getTriggers()
Fetch the key bindings for the forward and backward commands. They will not change while the dialog is open, but the context will. Bug 55581.

### addModifyListener

protected void addModifyListener(Text text)
Add modify listener to the search text, trigger search each time text changes. After the search the first matching result is selected.

### addKeyListener

protected void addKeyListener(Text text)
Add Key Listener to the search text. manage key events on search text

### getForeground

protected Color getForeground()

### getBackground

protected Color getBackground()

### addKeyListener

protected void addKeyListener(Table table, Shell dialog)
Add Keylistener to the table, user actions can influence the dialog.

### addTraverseListener

protected final void addTraverseListener(Table table)
Adds a listener to the given table that blocks all traversal operations.

Parameters:
  `table` - The table to which the traversal suppression should be added; must not be `null`.

### activate

protected void activate(IWorkbenchPage page, Object selectedItem)
Activate the selected item.

Parameters:
  `page` - the page
  `selectedItem` - the selected item

### cancel

protected void cancel(Shell dialog)
Close the dialog and set selection to null.

### ok

protected void ok(Shell dialog, Table table)
Close the dialog saving the selection

### addMouseListener

protected void addMouseListener(Table table, Shell dialog)
Add mouse listener to the table closing it when the mouse is pressed.

### isFiltered

protected boolean isFiltered()
True to show search text and enable filtering. False by default

### getFilter

protected ViewerFilter getFilter()
Return the filter to use. Null by default

### setMatcherString

protected void setMatcherString(String pattern)
Set the filter text entered by the User, does nothing by default

Parameters:
  `pattern` - may be used in overrides

### getWorkbenchPartReferenceText

protected String getWorkbenchPartReferenceText(WorkbenchPartReference ref)
Returns the text for the given `WorkbenchPartReference`

### setLabelProvider

protected void setLabelProvider(TableViewerColumn tableViewerColumn)
Sets the label provider for the only column visible in the table. Subclasses can override this method to style the table, using a StyledCellLabelProvider.

### getColumnLabelProvider

protected ColumnLabelProvider getColumnLabelProvider()
Default ColumnLabelProvider. The table has only one column

### getInput

protected abstract Object getInput(WorkbenchPage page)
Add all items to the dialog in the activation order

### getBackwardCommand

protected abstract ParameterizedCommand getBackwardCommand()
Get the backward command.

### getForwardCommand

protected abstract ParameterizedCommand getForwardCommand()
Get the forward command.

### getTableHeader

protected String getTableHeader(IWorkbenchPart activePart)
Get TableHeader, return title for non-filtered lists. By default returns an empty String. Subclasses can use the active part to detect the type of object.

Parameters:
  `activePart` - may be used in overrides

### getSelection

public Object getSelection()

### getWindow

public IWorkbenchWindow getWindow()

### getBackwardTriggerSequences

public TriggerSequence[] getBackwardTriggerSequences()

### getForwardTriggerSequences

public TriggerSequence[] getForwardTriggerSequences()

### setInitializationData

public void setInitializationData(IConfigurationElement config, String propertyName, Object data)
Description copied from interface: `IExecutableExtension`
This method is called by the implementation of the method `IConfigurationElement.createExecutableExtension` on a newly constructed extension, passing it its relevant configuration information. Most executable extensions only make use of the first two call arguments.

Regular executable extensions specify their Java implementation class name as an attribute of the configuration element for the extension. For example

        <action run="com.example.BaseAction"/>

In the above example, this method would be called with a reference to the `<action>` element (first argument), and `"run"` as the name of the attribute that defined this executable extension (second argument).

The last parameter is for the specific use of extension adapters and is typically not used by regular executable extensions.

There are two supported ways of associating additional adapter-specific data with the configuration in a way that is transparent to the extension point implementor:

(1) by specifying adapter data as part of the implementation class attribute value. The Java class name can be followed by a ":" separator, followed by any adapter data in string form. For example, if the extension point specifies an attribute `"run"` to contain the name of the extension implementation, an adapter can be configured as

        <action run="com.example.ExternalAdapter:./cmds/util.exe -opt 3"/>

(2) by converting the attribute used to specify the executable extension to a child element of the original configuration element, and specifying the adapter data in the form of xml markup. Using this form, the example above would become

        <action>
            <run class="com.xyz.ExternalAdapter">
                <parameter name="exec" value="./cmds/util.exe"/>
                <parameter name="opt"  value="3"/>
            </run>
        </action>

Form (2) will typically only be used for extension points that anticipate the majority of extensions configured into it will in fact be in the form of adapters.

In either case, the specified adapter class is instantiated using its 0-argument public constructor. The adapter data is passed as the last argument of this method. The data argument is defined as Object. It can have the following values:

- `null`, if no adapter data was supplied
- in case (1), the initialization data string is passed as a `String`
- in case (2), the initialization data is passed as a `Hashtable` containing the actual parameter names and values (both `String`s)

Specified by:
  `setInitializationData` in interface `IExecutableExtension`
Parameters:
  `config` - the configuration element used to trigger this execution. It can be queried by the executable extension for specific configuration properties
  `propertyName` - the name of an attribute of the configuration element used on the `createExecutableExtension(String)` call. This argument can be used in the cases where a single configuration element is used to define multiple executable extensions.
  `data` - adapter data in the form of a `String`, a `Hashtable`, or `null`.
See Also:
  - `IConfigurationElement.createExecutableExtension(String)`