Package org.eclipse.ui.dialogs
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 org.eclipse.ui.dialogs.FilteredItemsSelectionDialog
FilteredItemsSelectionDialog.AbstractContentProvider, FilteredItemsSelectionDialog.ItemsFilter, FilteredItemsSelectionDialog.SelectionHistory
-
Nested classes/interfaces inherited from class org.eclipse.jface.window.Window
Window.IExceptionHandler
-
-
Field Summary
-
Fields inherited from class org.eclipse.ui.dialogs.FilteredItemsSelectionDialog
CARET_BEGINNING, FULL_SELECTION, NONE
-
Fields inherited from class org.eclipse.jface.dialogs.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 org.eclipse.jface.window.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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
applyFilter()
Applies the filter created bycreateFilter()
method to the items list.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
getItemsComparator()
Returns comparator to sort items inside content provider.Object[]
getResult()
Returns the list of selections made by the user, ornull
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 org.eclipse.ui.dialogs.FilteredItemsSelectionDialog
accessedHistoryItem, addListFilter, close, computeResult, create, createDialogArea, fillContextMenu, getDialogBoundsSettings, getInitialPattern, getPatternControl, 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 org.eclipse.ui.dialogs.SelectionStatusDialog
createButtonBar, getFirstResult, setImage, setResult, setStatusLineAboveButtons, updateButtonsEnableState
-
Methods inherited from class org.eclipse.ui.dialogs.SelectionDialog
createButtonsForButtonBar, createMessageArea, getDialogBoundsStrategy, getInitialElementSelections, getInitialSelections, getMessage, getOkButton, isResizable, setDialogBoundsSettings, setInitialElementSelections, setInitialSelections, setMessage, setResult, setSelectionResult
-
Methods inherited from class org.eclipse.jface.dialogs.TrayDialog
closeTray, createHelpControl, getLayout, getTray, handleShellCloseEvent, isDialogHelpAvailable, isHelpAvailable, openTray, setDialogHelpAvailable, setHelpAvailable
-
Methods inherited from class org.eclipse.jface.dialogs.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 org.eclipse.jface.window.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
-
-
-
-
Constructor Detail
-
FilteredResourcesSelectionDialog
public FilteredResourcesSelectionDialog(Shell shell, boolean multi, IContainer container, int typesMask)
Creates a new instance of the class- Parameters:
shell
- the parent shellmulti
- the multi selection flagcontainer
- the container to select resources from, e.g. the workspace roottypesMask
- 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 inIResource.getType()
-
-
Method Detail
-
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 classSelectionStatusDialog
- Parameters:
shell
- the shell
-
setTitle
public void setTitle(String title)
Description copied from class:SelectionDialog
Sets the title for this dialog.- Overrides:
setTitle
in classSelectionDialog
- 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 classFilteredItemsSelectionDialog
- Returns:
- return dialog settings for this dialog
-
storeDialog
protected void storeDialog(IDialogSettings settings)
Description copied from class:FilteredItemsSelectionDialog
Stores dialog settings.- Overrides:
storeDialog
in classFilteredItemsSelectionDialog
- 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 classFilteredItemsSelectionDialog
- 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 classFilteredItemsSelectionDialog
- 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 classFilteredItemsSelectionDialog
- 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, ornull
if the selection was canceled.- Overrides:
getResult
in classSelectionDialog
- 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
andCANCEL
.- Overrides:
open
in classWindow
- Returns:
- the return code
- See Also:
Window.create()
-
getElementName
public String getElementName(Object item)
Description copied from class:FilteredItemsSelectionDialog
Returns name for then given object.- Specified by:
getElementName
in classFilteredItemsSelectionDialog
- 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 likeinstanceof
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 classFilteredItemsSelectionDialog
- 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 classFilteredItemsSelectionDialog
- 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 bycreateFilter()
method to the items list. When new filter is different than previous one it will cause refiltering.- Overrides:
applyFilter
in classFilteredItemsSelectionDialog
-
getItemsComparator
protected Comparator 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 thecompare(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 classFilteredItemsSelectionDialog
- 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 classFilteredItemsSelectionDialog
- Parameters:
contentProvider
- collector to add items to.FilteredItemsSelectionDialog.AbstractContentProvider.add(Object, FilteredItemsSelectionDialog.ItemsFilter)
only adds items that pass the givenitemsFilter
.itemsFilter
- the items filterprogressMonitor
- 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.
-
-