Class EditorSelectionDialog
- java.lang.Object
-
- org.eclipse.jface.window.Window
-
- org.eclipse.jface.dialogs.Dialog
-
- org.eclipse.ui.dialogs.EditorSelectionDialog
-
- All Implemented Interfaces:
IShellProvider
public class EditorSelectionDialog extends Dialog
This class is used to allow the user to select a dialog from the set of internal and external editors.- Since:
- 3.3
- Restriction:
- This class is not intended to be subclassed by clients.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.jface.window.Window
Window.IExceptionHandler
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringSTORE_ID_INTERNAL_EXTERNALFor internal use only.-
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 EditorSelectionDialog(Shell parentShell)Create an instance of this class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidbuttonPressed(int buttonId)This method is called if a button has been pressed.booleanclose()Close the window.protected voidconfigureShell(Shell shell)Configures the given shell in preparation for opening this window in it.protected voidcreateButtonsForButtonBar(Composite parent)Adds buttons to this dialog's button bar.protected ControlcreateDialogArea(Composite parent)Creates and returns the contents of the upper part of the dialog (above the button bar).protected voidfillEditorTable()Fills the editor table.protected IEditorDescriptor[]filterEditors(IEditorDescriptor[] editors)Returns an array of editors which have been filtered according to the array of editors in the editorsToFilter instance variable.protected IDialogSettingsgetDialogSettings()Return the dialog store to cache values intoprotected IEditorDescriptor[]getExternalEditors()Get a list of registered programs from the OSprotected IEditorDescriptor[]getInternalEditors()Returns the internal editorsIEditorDescriptorgetSelectedEditor()Return the editor the user selectedprotected voidhandleDoubleClickEvent()Handle a double click event on the listprotected booleanisResizable()Returns a boolean indicating whether the dialog should be considered resizable when the shell style is initially set.protected voidpromptForExternalEditor()Opens the prompt to select an external editor.protected voidrestoreWidgetValues()Use the dialog store to restore widget values to the values that they held last time this wizard was used to completion, if the previous file has same extension.protected voidsaveWidgetValues()Since Finish was pressed, write widget values to the dialog store so that they will persist into the next invocation of this wizard pagevoidsetEditorsToFilter(IEditorDescriptor[] editors)Set the editors which will not appear in the dialog.voidsetFileName(String fileName)Set the file name which can be used to store the selected editor preferencevoidsetMessage(String aMessage)Set the message displayed by this message dialogprotected voidupdateEnableState()Update enabled state.protected voidupdateOkButton()Update the button enablement state.-
Methods inherited from class org.eclipse.jface.dialogs.Dialog
applyDialogFont, cancelPressed, convertHeightInCharsToPixels, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, convertWidthInCharsToPixels, create, createButton, createButtonBar, createContents, dialogFontIsDefault, getBlockedHandler, getButton, getButtonBar, getCancelButton, getDialogArea, getDialogBoundsSettings, getDialogBoundsStrategy, getImage, getInitialLocation, getInitialSize, getOKButton, initializeBounds, initializeDialogUnits, okPressed, setBlockedHandler, setButtonLayoutData, setButtonLayoutFormData, shortenText
-
Methods inherited from class org.eclipse.jface.window.Window
canHandleShellCloseEvent, constrainShellSize, createShell, getConstrainedShellBounds, getContents, getDefaultImage, getDefaultImages, getDefaultOrientation, getLayout, getParentShell, getReturnCode, getShell, getShellListener, getShellStyle, getWindowManager, handleFontChange, handleShellCloseEvent, open, setBlockOnOpen, setDefaultImage, setDefaultImages, setDefaultModalParent, setDefaultOrientation, setExceptionHandler, setParentShell, setReturnCode, setShellStyle, setWindowManager
-
-
-
-
Field Detail
-
STORE_ID_INTERNAL_EXTERNAL
protected static final String STORE_ID_INTERNAL_EXTERNAL
For internal use only.- Since:
- 3.7
- See Also:
- Constant Field Values
- Restriction:
- This field is not intended to be referenced by clients.
-
-
Constructor Detail
-
EditorSelectionDialog
public EditorSelectionDialog(Shell parentShell)
Create an instance of this class.- Parameters:
parentShell- the parent shell
-
-
Method Detail
-
buttonPressed
protected void buttonPressed(int buttonId)
This method is called if a button has been pressed.- Overrides:
buttonPressedin classDialog- Parameters:
buttonId- the id of the button that was pressed (seeIDialogConstants.*_IDconstants)
-
close
public boolean close()
Close the window.- Overrides:
closein classDialog- Returns:
trueif the window is (or was already) closed, andfalseif it is still open- See Also:
Window.close()
-
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 classWindow- Parameters:
shell- the shell
-
createDialogArea
protected Control createDialogArea(Composite parent)
Creates and returns the contents of the upper part of the dialog (above the button bar). Subclasses should overide.- Overrides:
createDialogAreain classDialog- Parameters:
parent- the parent composite to contain the dialog area- Returns:
- the dialog area control
-
fillEditorTable
protected void fillEditorTable()
Fills the editor table.
-
getDialogSettings
protected IDialogSettings getDialogSettings()
Return the dialog store to cache values into
-
getExternalEditors
protected IEditorDescriptor[] getExternalEditors()
Get a list of registered programs from the OS
-
filterEditors
protected IEditorDescriptor[] filterEditors(IEditorDescriptor[] editors)
Returns an array of editors which have been filtered according to the array of editors in the editorsToFilter instance variable.- Parameters:
editors- an array of editors to filter- Returns:
- a filtered array of editors
-
getInternalEditors
protected IEditorDescriptor[] getInternalEditors()
Returns the internal editors
-
getSelectedEditor
public IEditorDescriptor getSelectedEditor()
Return the editor the user selected- Returns:
- the selected editor
-
promptForExternalEditor
protected void promptForExternalEditor()
Opens the prompt to select an external editor.
-
handleDoubleClickEvent
protected void handleDoubleClickEvent()
Handle a double click event on the list
-
restoreWidgetValues
protected void restoreWidgetValues()
Use the dialog store to restore widget values to the values that they held last time this wizard was used to completion, if the previous file has same extension.
-
saveWidgetValues
protected void saveWidgetValues()
Since Finish was pressed, write widget values to the dialog store so that they will persist into the next invocation of this wizard page
-
setMessage
public void setMessage(String aMessage)
Set the message displayed by this message dialog- Parameters:
aMessage- the message
-
setFileName
public void setFileName(String fileName)
Set the file name which can be used to store the selected editor preference- Parameters:
fileName- the file name- Since:
- 3.107
-
setEditorsToFilter
public void setEditorsToFilter(IEditorDescriptor[] editors)
Set the editors which will not appear in the dialog.- Parameters:
editors- an array of editors
-
updateEnableState
protected void updateEnableState()
Update enabled state.
-
createButtonsForButtonBar
protected void createButtonsForButtonBar(Composite parent)
Description copied from class:DialogAdds buttons to this dialog's button bar.The
Dialogimplementation of this framework method adds standard ok and cancel buttons using thecreateButtonframework method. These standard buttons will be accessible fromgetCancelButton, andgetOKButton. Subclasses may override.Note: The common button order is: {other buttons}, OK, Cancel. On some platforms,
Dialog.initializeBounds()will move the default button to the right.- Overrides:
createButtonsForButtonBarin classDialog- Parameters:
parent- the button bar composite
-
updateOkButton
protected void updateOkButton()
Update the button enablement state.
-
isResizable
protected boolean isResizable()
Description copied from class:DialogReturns a boolean indicating whether the dialog should be considered resizable when the shell style is initially set.This method is used to ensure that all style bits appropriate for resizable dialogs are added to the shell style. Individual dialogs may always set the shell style to ensure that a dialog is resizable, but using this method ensures that resizable dialogs will be created with the same set of style bits.
Style bits will never be removed based on the return value of this method. For example, if a dialog returns
false, but also sets a style bit for a SWT.RESIZE border, the style bit will be honored.- Overrides:
isResizablein classDialog- Returns:
- a boolean indicating whether the dialog is resizable and should have the default style bits for resizable dialogs
-
-