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
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 ClassesModifier and TypeClassDescriptionprotected classFilters resources using pattern and showDerived flag.Nested classes/interfaces inherited from class org.eclipse.ui.dialogs.FilteredItemsSelectionDialog
FilteredItemsSelectionDialog.AbstractContentProvider, FilteredItemsSelectionDialog.ItemsFilter, FilteredItemsSelectionDialog.SelectionHistoryNested 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, NONEFields 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, ELLIPSISFields inherited from class org.eclipse.jface.window.Window
CANCEL, OK, resizeHasOccurred -
Constructor Summary
ConstructorsConstructorDescriptionFilteredResourcesSelectionDialog(Shell shell, boolean multi, IContainer container, int typesMask) Creates a new instance of the class -
Method Summary
Modifier and TypeMethodDescriptionprotected voidApplies the filter created bycreateFilter()method to the items list.booleanclose()Closes this window, disposes its shell, and removes this window from its window manager (if it has one).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.ItemsFilterCreates 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 IDialogSettingsReturns the dialog settings.getElementName(Object item) Returns name for then given object.protected Comparator<IResource> Returns comparator to sort items inside content provider.Object[]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.voidSets 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, 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, updateStatusMethods inherited from class org.eclipse.ui.dialogs.SelectionStatusDialog
createButtonBar, getFirstResult, setImage, setResult, setStatusLineAboveButtons, updateButtonsEnableStateMethods inherited from class org.eclipse.ui.dialogs.SelectionDialog
createButtonsForButtonBar, createMessageArea, getDialogBoundsStrategy, getInitialElementSelections, getInitialSelections, getMessage, getOkButton, isResizable, setDialogBoundsSettings, setInitialElementSelections, setInitialSelections, setMessage, setResult, setSelectionResultMethods inherited from class org.eclipse.jface.dialogs.TrayDialog
closeTray, createHelpControl, getLayout, getTray, handleShellCloseEvent, isDialogHelpAvailable, isHelpAvailable, openTray, setDialogHelpAvailable, setHelpAvailableMethods 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, shortenTextMethods 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 Details
-
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 Details
-
configureShell
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
Description copied from class:SelectionDialogSets the title for this dialog.- Overrides:
setTitlein classSelectionDialog- Parameters:
title- the title
-
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
Description copied from class:FilteredItemsSelectionDialogStores dialog settings.- Overrides:
storeDialogin classFilteredItemsSelectionDialog- Parameters:
settings- settings used to store dialog
-
restoreDialog
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
Description copied from class:FilteredItemsSelectionDialogFills the menu of the dialog.- Overrides:
fillViewMenuin classFilteredItemsSelectionDialog- Parameters:
menuManager- the menu manager
-
createExtendedContentArea
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
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. -
close
public boolean close()Description copied from class:WindowCloses this window, disposes its shell, and removes this window from its window manager (if it has one).This framework method may be extended (
super.closemust be called).Note that in order to prevent recursive calls to this method it does not call
Shell#close(). As a resultShellListeners will not receive ashellClosedevent.- Overrides:
closein classFilteredItemsSelectionDialog- Returns:
trueif the window is (or was already) closed, andfalseif it is still open- See Also:
-
getElementName
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
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
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
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.
-