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 classFilteredResourcesSelectionDialog.ResourceFilterFilters 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 voidapplyFilter()Applies the filter created bycreateFilter()method to the items list.protected voidconfigureShell(Shell shell)Configures the given shell in preparation for opening this window in it.protected ControlcreateExtendedContentArea(Composite parent)Creates an extra content area, which will be located above the details.protected FilteredItemsSelectionDialog.ItemsFiltercreateFilter()Creates an instance of a filter.protected voidfillContentProvider(FilteredItemsSelectionDialog.AbstractContentProvider contentProvider, FilteredItemsSelectionDialog.ItemsFilter itemsFilter, IProgressMonitor progressMonitor)Fills the content provider with matching items.protected voidfillViewMenu(IMenuManager menuManager)Fills the menu of the dialog.protected IDialogSettingsgetDialogSettings()Returns the dialog settings.StringgetElementName(Object item)Returns name for then given object.protected ComparatorgetItemsComparator()Returns comparator to sort items inside content provider.Object[]getResult()Returns the list of selections made by the user, ornullif the selection was canceled.intopen()Opens this window, creating it first if it has not yet been created.protected voidrestoreDialog(IDialogSettings settings)Restores dialog using persisted settings.voidsetTitle(String title)Sets the title for this dialog.protected voidstoreDialog(IDialogSettings settings)Stores dialog settings.protected IStatusvalidateItem(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:WindowConfigures 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:
configureShellin classSelectionStatusDialog- Parameters:
shell- the shell
-
setTitle
public void setTitle(String title)
Description copied from class:SelectionDialogSets the title for this dialog.- Overrides:
setTitlein classSelectionDialog- Parameters:
title- the title
-
getDialogSettings
protected IDialogSettings getDialogSettings()
Description copied from class:FilteredItemsSelectionDialogReturns the dialog settings. Returned object can't be null.- Specified by:
getDialogSettingsin classFilteredItemsSelectionDialog- Returns:
- return dialog settings for this dialog
-
storeDialog
protected void storeDialog(IDialogSettings settings)
Description copied from class:FilteredItemsSelectionDialogStores dialog settings.- Overrides:
storeDialogin classFilteredItemsSelectionDialog- Parameters:
settings- settings used to store dialog
-
restoreDialog
protected void restoreDialog(IDialogSettings settings)
Description copied from class:FilteredItemsSelectionDialogRestores dialog using persisted settings. The default implementation restores the status of the details line and the selection history.- Overrides:
restoreDialogin classFilteredItemsSelectionDialog- Parameters:
settings- settings used to restore dialog
-
fillViewMenu
protected void fillViewMenu(IMenuManager menuManager)
Description copied from class:FilteredItemsSelectionDialogFills the menu of the dialog.- Overrides:
fillViewMenuin classFilteredItemsSelectionDialog- Parameters:
menuManager- the menu manager
-
createExtendedContentArea
protected Control createExtendedContentArea(Composite parent)
Description copied from class:FilteredItemsSelectionDialogCreates an extra content area, which will be located above the details.- Specified by:
createExtendedContentAreain classFilteredItemsSelectionDialog- Parameters:
parent- parent to create the dialog widgets in- Returns:
- an extra content area
-
getResult
public Object[] getResult()
Description copied from class:SelectionDialogReturns the list of selections made by the user, ornullif the selection was canceled.- Overrides:
getResultin classSelectionDialog- Returns:
- the array of selected elements, or
nullif Cancel was pressed
-
open
public int open()
Description copied from class:WindowOpens 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:OKandCANCEL.- Overrides:
openin classWindow- Returns:
- the return code
- See Also:
Window.create()
-
getElementName
public String getElementName(Object item)
Description copied from class:FilteredItemsSelectionDialogReturns name for then given object.- Specified by:
getElementNamein 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 likeinstanceofinside the method).- Returns:
- name of the given item
-
validateItem
protected IStatus validateItem(Object item)
Description copied from class:FilteredItemsSelectionDialogValidates 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:
validateItemin 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:FilteredItemsSelectionDialogCreates an instance of a filter.- Specified by:
createFilterin 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:FilteredItemsSelectionDialogApplies the filter created bycreateFilter()method to the items list. When new filter is different than previous one it will cause refiltering.- Overrides:
applyFilterin classFilteredItemsSelectionDialog
-
getItemsComparator
protected Comparator getItemsComparator()
Description copied from class:FilteredItemsSelectionDialogReturns 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:
getItemsComparatorin 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:FilteredItemsSelectionDialogFills the content provider with matching items.- Specified by:
fillContentProviderin 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.
-
-