Package org.eclipse.ui.dialogs
Class ResourceListSelectionDialog
- 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.ResourceListSelectionDialog
-
- All Implemented Interfaces:
IShellProvider
public class ResourceListSelectionDialog extends SelectionDialog
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:
- 2.1
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.jface.window.Window
Window.IExceptionHandler
-
-
Field Summary
-
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 ResourceListSelectionDialog(Shell parentShell, IContainer container, int typeMask)Creates a new instance of the class.ResourceListSelectionDialog(Shell parentShell, IResource[] resources)Creates a new instance of the class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringadjustPattern()Adjust the pattern string for matching.protected voidcancelPressed()Notifies that the cancel button of this dialog has been pressed.booleanclose()Closes this window, disposes its shell, and removes this window from its window manager (if it has one).voidcreate()Creates this window's widgetry in a new top-level shell.protected ControlcreateDialogArea(Composite parent)Creates the contents of this dialog, initializes the listener and the update thread.booleangetAllowUserToToggleDerived()Returns whether to include a "Show derived resources" checkbox in the dialog.protected IDialogSettingsgetDialogBoundsSettings()Gets the dialog settings that should be used for remembering the bounds of the dialog, according to the dialog bounds strategy.protected booleangetShowDerived()Returns whether derived resources should be shown in the list.protected voidokPressed()The user has selected a resource and the dialog is closing.protected voidrefresh(boolean force)Refreshes the filtered list of resources.protected booleanselect(IResource resource)Use this method to further filter resources.voidsetAllowUserToToggleDerived(boolean allow)Sets whether to include a "Show derived resources" checkbox in the dialog.protected voidsetShowDerived(boolean show)Sets whether derived resources should be shown in the list.protected voidupdateOKState(boolean state)Update the enabled state of the OK button.-
Methods inherited from class org.eclipse.ui.dialogs.SelectionDialog
configureShell, createButtonsForButtonBar, createMessageArea, getDialogBoundsStrategy, getInitialElementSelections, getInitialSelections, getMessage, getOkButton, getResult, isResizable, setDialogBoundsSettings, setInitialElementSelections, setInitialSelections, setMessage, setResult, setSelectionResult, setTitle
-
Methods inherited from class org.eclipse.jface.dialogs.TrayDialog
closeTray, createButtonBar, createHelpControl, getLayout, getTray, handleShellCloseEvent, isDialogHelpAvailable, isHelpAvailable, openTray, setDialogHelpAvailable, setHelpAvailable
-
Methods inherited from class org.eclipse.jface.dialogs.Dialog
applyDialogFont, buttonPressed, 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, open, setBlockOnOpen, setDefaultImage, setDefaultImages, setDefaultModalParent, setDefaultOrientation, setExceptionHandler, setParentShell, setReturnCode, setShellStyle, setWindowManager
-
-
-
-
Constructor Detail
-
ResourceListSelectionDialog
public ResourceListSelectionDialog(Shell parentShell, IResource[] resources)
Creates a new instance of the class.- Parameters:
parentShell- shell to parent the dialog onresources- resources to display in the dialog
-
ResourceListSelectionDialog
public ResourceListSelectionDialog(Shell parentShell, IContainer container, int typeMask)
Creates a new instance of the class. When this constructor is used to create the dialog, resources will be gathered dynamically as the pattern string is specified. Only resources of the given types that match the pattern string will be listed. To further filter the matching resources,- Parameters:
parentShell- shell to parent the dialog oncontainer- container to get resources fromtypeMask- mask containing IResource types to be considered- See Also:
select(IResource)
-
-
Method Detail
-
adjustPattern
protected String adjustPattern()
Adjust the pattern string for matching.
-
cancelPressed
protected void cancelPressed()
Description copied from class:DialogNotifies that the cancel button of this dialog has been pressed.The
Dialogimplementation of this framework method sets this dialog's return code toWindow.CANCELand closes the dialog. Subclasses may override if desired.- Overrides:
cancelPressedin classDialog- See Also:
Dialog.cancelPressed()
-
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 classDialog- Returns:
trueif the window is (or was already) closed, andfalseif it is still open- See Also:
Window.close()
-
create
public void create()
Description copied from class:WindowCreates this window's widgetry in a new top-level shell.The default implementation of this framework method creates this window's shell (by calling
createShell), and its controls (by callingcreateContents), then initializes this window's shell bounds (by callinginitializeBounds).- Overrides:
createin classDialog- See Also:
Window.create()
-
createDialogArea
protected Control createDialogArea(Composite parent)
Creates the contents of this dialog, initializes the listener and the update thread.- Overrides:
createDialogAreain classDialog- Parameters:
parent- parent to create the dialog widgets in- Returns:
- the dialog area control
-
getAllowUserToToggleDerived
public boolean getAllowUserToToggleDerived()
Returns whether to include a "Show derived resources" checkbox in the dialog. The default isfalse.- Returns:
trueto include the checkbox,falseto omit- Since:
- 3.1
-
setAllowUserToToggleDerived
public void setAllowUserToToggleDerived(boolean allow)
Sets whether to include a "Show derived resources" checkbox in the dialog.- Parameters:
allow-trueto include the checkbox,falseto omit- Since:
- 3.1
-
getShowDerived
protected boolean getShowDerived()
Returns whether derived resources should be shown in the list. The default isfalse.- Returns:
trueto show derived resources,falseto hide them- Since:
- 3.1
-
setShowDerived
protected void setShowDerived(boolean show)
Sets whether derived resources should be shown in the list.- Parameters:
show-trueto show derived resources,falseto hide them- Since:
- 3.1
-
okPressed
protected void okPressed()
The user has selected a resource and the dialog is closing. Set the selected resource as the dialog result.
-
select
protected boolean select(IResource resource)
Use this method to further filter resources. As resources are gathered, if a resource matches the current pattern string, this method will be called. If this method answers false, the resource will not be included in the list of matches and the resource's children will NOT be considered for matching.
-
refresh
protected void refresh(boolean force)
Refreshes the filtered list of resources. Called when the text in the pattern text entry has changed.- Parameters:
force- iftruea refresh is forced, iffalsea refresh only occurs if the pattern has changed- Since:
- 3.1
-
updateOKState
protected void updateOKState(boolean state)
Update the enabled state of the OK button. To be called when the resource list is updated.- Parameters:
state- the new enabled state of the button
-
getDialogBoundsSettings
protected IDialogSettings getDialogBoundsSettings()
Description copied from class:SelectionDialogGets the dialog settings that should be used for remembering the bounds of the dialog, according to the dialog bounds strategy. Overridden to provide the dialog settings that were set usingSelectionDialog.setDialogBoundsSettings(IDialogSettings, int).- Overrides:
getDialogBoundsSettingsin classSelectionDialog- Returns:
- the dialog settings used to store the dialog's location and/or size,
or
nullif the dialog's bounds should not be stored. - See Also:
Dialog.getDialogBoundsStrategy(),SelectionDialog.setDialogBoundsSettings(IDialogSettings, int)
-
-