# Class FilteredResourcesSelectionDialog

java.lang.Object
org.eclipse.jface.window.Window
org.eclipse.jface.dialogs.Dialog
org.eclipse.jface.dialogs.TrayDialog
org.eclipse.ui.dialogs.SelectionDialog
org.eclipse.ui.dialogs.SelectionStatusDialog
org.eclipse.ui.dialogs.FilteredItemsSelectionDialog
org.eclipse.ui.dialogs.FilteredResourcesSelectionDialog

All Implemented Interfaces:
  `IShellProvider`

public class FilteredResourcesSelectionDialog extends FilteredItemsSelectionDialog
Shows a list of resources to the user with a text entry field for a string pattern used to filter the list of resources.

Since:
  3.3

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`protected class`
`FilteredResourcesSelectionDialog.ResourceFilter`
Filters resources using pattern and showDerived flag.

### Nested classes/interfaces inherited from class FilteredItemsSelectionDialog

`FilteredItemsSelectionDialog.AbstractContentProvider, FilteredItemsSelectionDialog.ItemsFilter, FilteredItemsSelectionDialog.SelectionHistory`

### Nested classes/interfaces inherited from class Window

`Window.IExceptionHandler`

## Field Summary

### Fields inherited from class FilteredItemsSelectionDialog

`CARET_BEGINNING, FULL_SELECTION, JOB_FAMILY, NONE`

### Fields inherited from class Dialog

`blockedHandler, buttonBar, DIALOG_DEFAULT_BOUNDS, DIALOG_PERSISTLOCATION, DIALOG_PERSISTSIZE, dialogArea, DLG_IMG_ERROR, DLG_IMG_HELP, DLG_IMG_INFO, DLG_IMG_MESSAGE_ERROR, DLG_IMG_MESSAGE_INFO, DLG_IMG_MESSAGE_WARNING, DLG_IMG_QUESTION, DLG_IMG_WARNING, ELLIPSIS`

### Fields inherited from class Window

`CANCEL, OK, resizeHasOccurred`

## Constructor Summary

Constructors
Constructor
Description
`FilteredResourcesSelectionDialog(Shell shell, boolean multi, IContainer container, int typesMask)`
Creates a new instance of the class

## Method Summary

Modifier and Type
Method
Description
`protected void`
`applyFilter()`
Applies the filter created by `createFilter()` method to the items list.
`boolean`
`close()`
Closes this window, disposes its shell, and removes this window from its window manager (if it has one).
`protected void`
`configureShell(Shell shell)`
Configures the given shell in preparation for opening this window in it.
`protected Control`
`createExtendedContentArea(Composite parent)`
Creates an extra content area, which will be located above the details.
`protected FilteredItemsSelectionDialog.ItemsFilter`
`createFilter()`
Creates an instance of a filter.
`protected void`
`fillContentProvider(FilteredItemsSelectionDialog.AbstractContentProvider contentProvider, FilteredItemsSelectionDialog.ItemsFilter itemsFilter, IProgressMonitor progressMonitor)`
Fills the content provider with matching items.
`protected void`
`fillViewMenu(IMenuManager menuManager)`
Fills the menu of the dialog.
`protected IDialogSettings`
`getDialogSettings()`
Returns the dialog settings.
`String`
`getElementName(Object item)`
Returns name for then given object.
`protected Comparator<IResource>`
`getItemsComparator()`
Returns comparator to sort items inside content provider.
`Object[]`
`getResult()`
Returns the list of selections made by the user, or `null` if the selection was canceled.
`int`
`open()`
Opens this window, creating it first if it has not yet been created.
`protected void`
`restoreDialog(IDialogSettings settings)`
Restores dialog using persisted settings.
`void`
`setTitle(String title)`
Sets the title for this dialog.
`protected void`
`storeDialog(IDialogSettings settings)`
Stores dialog settings.
`protected IStatus`
`validateItem(Object item)`
Validates the item.

### Methods inherited from class FilteredItemsSelectionDialog

`accessedHistoryItem, addListFilter, computeResult, create, createDialogArea, fillContextMenu, getDialogBoundsSettings, getInitialPattern, getPatternControl, getPatternText, getSelectedItems, getSelectionHistory, getStyledStringHighlighter, handleDoubleClick, handleSelected, isDuplicateElement, isHistoryElement, okPressed, refresh, reloadCache, removeHistoryItem, scheduleProgressMessageRefresh, scheduleRefresh, setDetailsLabelProvider, setInitialPattern, setInitialPattern, setListLabelProvider, setListSelectionLabelDecorator, setSelectionHistory, setSeparatorLabel, setStyledStringHighlighter, updateProgressLabel, updateStatus`

### Methods inherited from class SelectionStatusDialog

`createButtonBar, getFirstResult, setImage, setResult, setStatusLineAboveButtons, updateButtonsEnableState`

### Methods inherited from class SelectionDialog

`createButtonsForButtonBar, createMessageArea, getDialogBoundsStrategy, getInitialElementSelections, getInitialSelections, getMessage, getOkButton, isResizable, setDialogBoundsSettings, setInitialElementSelections, setInitialSelections, setMessage, setResult, setSelectionResult`

### Methods inherited from class TrayDialog

`closeTray, createHelpControl, getLayout, getTray, handleShellCloseEvent, isDialogHelpAvailable, isHelpAvailable, openTray, setDialogHelpAvailable, setHelpAvailable`

### Methods inherited from class Dialog

`applyDialogFont, buttonPressed, cancelPressed, convertHeightInCharsToPixels, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, convertWidthInCharsToPixels, createButton, createContents, dialogFontIsDefault, getBlockedHandler, getButton, getButtonBar, getCancelButton, getDialogArea, getImage, getInitialLocation, getInitialSize, getOKButton, initializeBounds, initializeDialogUnits, setBlockedHandler, setButtonLayoutData, setButtonLayoutFormData, shortenText`

### Methods inherited from class Window

`canHandleShellCloseEvent, constrainShellSize, createShell, getConstrainedShellBounds, getContents, getDefaultImage, getDefaultImages, getDefaultOrientation, getParentShell, getReturnCode, getShell, getShellListener, getShellStyle, getWindowManager, handleFontChange, setBlockOnOpen, setDefaultImage, setDefaultImages, setDefaultModalParent, setDefaultOrientation, setExceptionHandler, setParentShell, setReturnCode, setShellStyle, setWindowManager`

### Methods inherited from class Object

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

## Constructor Details

### FilteredResourcesSelectionDialog

public FilteredResourcesSelectionDialog(Shell shell, boolean multi, IContainer container, int typesMask)
Creates a new instance of the class

Parameters:
  `shell` - the parent shell
  `multi` - the multi selection flag
  `container` - the container to select resources from, e.g. the workspace root
  `typesMask` - a mask specifying which resource types should be shown in the dialog. The mask should contain one or more of the resource type bit masks defined in `IResource.getType()`

## Method Details

### configureShell

protected void configureShell(Shell shell)
Description copied from class: `Window`
Configures the given shell in preparation for opening this window in it.

The default implementation of this framework method sets the shell's image and gives it a grid layout. Subclasses may extend or reimplement.

Overrides:
  `configureShell` in class `SelectionStatusDialog`
Parameters:
  `shell` - the shell

### setTitle

public void setTitle(String title)
Description copied from class: `SelectionDialog`
Sets the title for this dialog.

Overrides:
  `setTitle` in class `SelectionDialog`
Parameters:
  `title` - the title

### getDialogSettings

protected IDialogSettings getDialogSettings()
Description copied from class: `FilteredItemsSelectionDialog`
Returns the dialog settings. Returned object can't be null.

Specified by:
  `getDialogSettings` in class `FilteredItemsSelectionDialog`
Returns:
  return dialog settings for this dialog

### storeDialog

protected void storeDialog(IDialogSettings settings)
Description copied from class: `FilteredItemsSelectionDialog`
Stores dialog settings.

Overrides:
  `storeDialog` in class `FilteredItemsSelectionDialog`
Parameters:
  `settings` - settings used to store dialog

### restoreDialog

protected void restoreDialog(IDialogSettings settings)
Description copied from class: `FilteredItemsSelectionDialog`
Restores dialog using persisted settings. The default implementation restores the status of the details line and the selection history.

Overrides:
  `restoreDialog` in class `FilteredItemsSelectionDialog`
Parameters:
  `settings` - settings used to restore dialog

### fillViewMenu

protected void fillViewMenu(IMenuManager menuManager)
Description copied from class: `FilteredItemsSelectionDialog`
Fills the menu of the dialog.

Overrides:
  `fillViewMenu` in class `FilteredItemsSelectionDialog`
Parameters:
  `menuManager` - the menu manager

### createExtendedContentArea

protected Control createExtendedContentArea(Composite parent)
Description copied from class: `FilteredItemsSelectionDialog`
Creates an extra content area, which will be located above the details.

Specified by:
  `createExtendedContentArea` in class `FilteredItemsSelectionDialog`
Parameters:
  `parent` - parent to create the dialog widgets in
Returns:
  an extra content area

### getResult

public Object[] getResult()
Description copied from class: `SelectionDialog`
Returns the list of selections made by the user, or `null` if the selection was canceled.

Overrides:
  `getResult` in class `SelectionDialog`
Returns:
  the array of selected elements, or `null` if Cancel was pressed

### open

public int open()
Description copied from class: `Window`
Opens this window, creating it first if it has not yet been created.

If this window has been configured to block on open ( `setBlockOnOpen`), this method waits until the window is closed by the end user, and then it returns the window's return code; otherwise, this method returns immediately. A window's return codes are window-specific, although two standard return codes are predefined: `OK` and `CANCEL`.

Overrides:
  `open` in class `Window`
Returns:
  the return code
See Also:
  - `Window.create()`

### close

public boolean close()
Description copied from class: `Window`
Closes this window, disposes its shell, and removes this window from its window manager (if it has one).

This framework method may be extended (`super.close` must be called).

Note that in order to prevent recursive calls to this method it does not call `Shell#close()`. As a result `ShellListener`s will not receive a `shellClosed` event.

Overrides:
  `close` in class `FilteredItemsSelectionDialog`
Returns:
  `true` if the window is (or was already) closed, and `false` if it is still open
See Also:
  - `Window.close()`

### getElementName

public String getElementName(Object item)
Description copied from class: `FilteredItemsSelectionDialog`
Returns name for then given object.

Specified by:
  `getElementName` in class `FilteredItemsSelectionDialog`
Parameters:
  `item` - an object from the content provider. Subclasses should pay attention to the passed argument. They should either only pass objects of a known type (one used in content provider) or make sure that passed parameter is the expected one (by type checking like `instanceof` inside the method).
Returns:
  name of the given item

### validateItem

protected IStatus validateItem(Object item)
Description copied from class: `FilteredItemsSelectionDialog`
Validates the item. When items on the items list are selected or deselected, it validates each item in the selection and the dialog status depends on all validations.

Specified by:
  `validateItem` in class `FilteredItemsSelectionDialog`
Parameters:
  `item` - an item to be checked
Returns:
  status of the dialog to be set

### createFilter

protected FilteredItemsSelectionDialog.ItemsFilter createFilter()
Description copied from class: `FilteredItemsSelectionDialog`
Creates an instance of a filter.

Specified by:
  `createFilter` in class `FilteredItemsSelectionDialog`
Returns:
  a filter for items on the items list. Can be `null`, no filtering will be applied then, causing no item to be shown in the list.

### applyFilter

protected void applyFilter()
Description copied from class: `FilteredItemsSelectionDialog`
Applies the filter created by `createFilter()` method to the items list. When new filter is different than previous one it will cause refiltering.

Overrides:
  `applyFilter` in class `FilteredItemsSelectionDialog`

### getItemsComparator

protected Comparator<IResource> getItemsComparator()
Description copied from class: `FilteredItemsSelectionDialog`
Returns comparator to sort items inside content provider. Returned object will be probably created as an anonymous class. Parameters passed to the `compare(java.lang.Object, java.lang.Object)` are going to be the same type as the one used in the content provider.

Specified by:
  `getItemsComparator` in class `FilteredItemsSelectionDialog`
Returns:
  comparator to sort items content provider

### fillContentProvider

protected void fillContentProvider(FilteredItemsSelectionDialog.AbstractContentProvider contentProvider, FilteredItemsSelectionDialog.ItemsFilter itemsFilter, IProgressMonitor progressMonitor) throws CoreException
Description copied from class: `FilteredItemsSelectionDialog`
Fills the content provider with matching items.

Specified by:
  `fillContentProvider` in class `FilteredItemsSelectionDialog`
Parameters:
  `contentProvider` - collector to add items to. `FilteredItemsSelectionDialog.AbstractContentProvider.add(Object, FilteredItemsSelectionDialog.ItemsFilter)` only adds items that pass the given `itemsFilter`.
  `itemsFilter` - the items filter
  `progressMonitor` - must be used to report search progress. The state of this progress monitor reflects the state of the filtering process.
Throws:
  `CoreException` - Something went wrong.