Class SaveAsDialog
- java.lang.Object
-
- org.eclipse.jface.window.Window
-
- org.eclipse.jface.dialogs.Dialog
-
- org.eclipse.jface.dialogs.TrayDialog
-
- org.eclipse.jface.dialogs.TitleAreaDialog
-
- org.eclipse.ui.dialogs.SaveAsDialog
-
- All Implemented Interfaces:
IShellProvider
public class SaveAsDialog extends TitleAreaDialog
A standard "Save As" dialog which solicits a path from the user. ThegetResultmethod returns the path. Note that the folder at the specified path might not exist and might need to be created.This class may be instantiated; it is not intended to be subclassed.
- See Also:
ContainerGenerator- 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 inherited from class org.eclipse.jface.dialogs.TitleAreaDialog
DLG_IMG_TITLE_BANNER, DLG_IMG_TITLE_ERROR, INFO_MESSAGE, WARNING_MESSAGE
-
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 SaveAsDialog(Shell parentShell)Creates a new Save As dialog for no specific file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanclose()TheSaveAsDialogimplementation of thisWindowmethod disposes of the banner image when the dialog is closed.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 ControlcreateContents(Composite parent)TheDialogimplementation of thisWindowmethod creates and lays out the top level composite for the dialog, and determines the appropriate horizontal and vertical dialog units based on the font size.protected ControlcreateDialogArea(Composite parent)Creates and returns the contents of the upper part of this dialog (above the button bar).protected IDialogSettingsgetDialogBoundsSettings()Gets the dialog settings that should be used for remembering the bounds of of the dialog, according to the dialog bounds strategy.IPathgetResult()Returns the full path entered by the user.protected booleanisResizable()Returns a boolean indicating whether the dialog should be considered resizable when the shell style is initially set.protected voidokPressed()Notifies that the ok button of this dialog has been pressed.protected voidsetDialogComplete(boolean value)Sets the completion state of this dialog and adjusts the enable state of the Ok button accordingly.voidsetOriginalFile(IFile originalFile)Sets the original file to use.voidsetOriginalName(String originalName)Set the original file name to use.-
Methods inherited from class org.eclipse.jface.dialogs.TitleAreaDialog
getErrorMessage, getInitialSize, getMessage, getTitleArea, getTitleImageLabel, setErrorMessage, setMessage, setMessage, setTitle, setTitleAreaColor, setTitleImage
-
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, cancelPressed, convertHeightInCharsToPixels, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, convertWidthInCharsToPixels, create, createButton, dialogFontIsDefault, getBlockedHandler, getButton, getButtonBar, getCancelButton, getDialogArea, getDialogBoundsStrategy, getImage, getInitialLocation, 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
-
SaveAsDialog
public SaveAsDialog(Shell parentShell)
Creates a new Save As dialog for no specific file.- Parameters:
parentShell- the parent shell
-
-
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 classWindow- Parameters:
shell- the shell
-
createContents
protected Control createContents(Composite parent)
Description copied from class:DialogTheDialogimplementation of thisWindowmethod creates and lays out the top level composite for the dialog, and determines the appropriate horizontal and vertical dialog units based on the font size. It then calls thecreateDialogAreaandcreateButtonBarmethods to create the dialog area and button bar, respectively. OverridingcreateDialogAreaandcreateButtonBarare recommended rather than overriding this method.- Overrides:
createContentsin classTitleAreaDialog- Parameters:
parent- the parent composite for the controls in this window. The type of layout used is determined by getLayout()- Returns:
- the control that will be returned by subsequent calls to getContents()
-
close
public boolean close()
TheSaveAsDialogimplementation of thisWindowmethod disposes of the banner image when the dialog is closed.- Overrides:
closein classDialog- Returns:
trueif the window is (or was already) closed, andfalseif it is still open- See Also:
Window.close()
-
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
-
createDialogArea
protected Control createDialogArea(Composite parent)
Description copied from class:TitleAreaDialogCreates and returns the contents of the upper part of this dialog (above the button bar).The
Dialogimplementation of this framework method creates and returns a newCompositewith no margins and spacing. Subclasses should override.- Overrides:
createDialogAreain classTitleAreaDialog- Parameters:
parent- The parent composite to contain the dialog area- Returns:
- the dialog area control
-
getResult
public IPath getResult()
Returns the full path entered by the user.Note that the file and container might not exist and would need to be created. See the
IFile.createmethod and theContainerGeneratorclass.- Returns:
- the path, or
nullif Cancel was pressed
-
okPressed
protected void okPressed()
Description copied from class:DialogNotifies that the ok button of this dialog has been pressed.The
Dialogimplementation of this framework method sets this dialog's return code toWindow.OKand closes the dialog. Subclasses may override.
-
setDialogComplete
protected void setDialogComplete(boolean value)
Sets the completion state of this dialog and adjusts the enable state of the Ok button accordingly.- Parameters:
value-trueif this dialog is compelete, andfalseotherwise
-
setOriginalFile
public void setOriginalFile(IFile originalFile)
Sets the original file to use.- Parameters:
originalFile- the original file
-
setOriginalName
public void setOriginalName(String originalName)
Set the original file name to use. Used instead ofsetOriginalFilewhen the original resource is not an IFile. Must be called beforecreate.- Parameters:
originalName- default file name
-
getDialogBoundsSettings
protected IDialogSettings getDialogBoundsSettings()
Description copied from class:DialogGets the dialog settings that should be used for remembering the bounds of of the dialog, according to the dialog bounds strategy.- Overrides:
getDialogBoundsSettingsin classDialog- Returns:
- settings the dialog settings used to store the dialog's location
and/or size, or
nullif the dialog's bounds should never be stored. - See Also:
Dialog.getDialogBoundsStrategy()
-
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
-
-