public class SaveAsDialog extends TitleAreaDialog
getResult
method 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.
ContainerGenerator
Window.IExceptionHandler
DLG_IMG_TITLE_BANNER, DLG_IMG_TITLE_ERROR, INFO_MESSAGE, WARNING_MESSAGE
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
CANCEL, OK, resizeHasOccurred
Constructor and Description |
---|
SaveAsDialog(Shell parentShell)
Creates a new Save As dialog for no specific file.
|
Modifier and Type | Method and Description |
---|---|
boolean |
close()
The
SaveAsDialog implementation of this Window
method disposes of the banner image when the dialog is closed. |
protected void |
configureShell(Shell shell)
Configures the given shell in preparation for opening this window in it.
|
protected void |
createButtonsForButtonBar(Composite parent)
Adds buttons to this dialog's button bar.
|
protected Control |
createContents(Composite parent)
The
Dialog implementation of this Window
method 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 Control |
createDialogArea(Composite parent)
Creates and returns the contents of the upper part of this dialog (above
the button bar).
|
protected IDialogSettings |
getDialogBoundsSettings()
Gets the dialog settings that should be used for remembering the bounds of
of the dialog, according to the dialog bounds strategy.
|
IPath |
getResult()
Returns the full path entered by the user.
|
protected boolean |
isResizable()
Returns a boolean indicating whether the dialog should be
considered resizable when the shell style is initially
set.
|
protected void |
okPressed()
Notifies that the ok button of this dialog has been pressed.
|
protected void |
setDialogComplete(boolean value)
Sets the completion state of this dialog and adjusts the enable state of
the Ok button accordingly.
|
void |
setOriginalFile(IFile originalFile)
Sets the original file to use.
|
void |
setOriginalName(String originalName)
Set the original file name to use.
|
getErrorMessage, getInitialSize, getMessage, getTitleArea, getTitleImageLabel, setErrorMessage, setMessage, setMessage, setTitle, setTitleAreaColor, setTitleImage
closeTray, createButtonBar, createHelpControl, getLayout, getTray, handleShellCloseEvent, isDialogHelpAvailable, isHelpAvailable, openTray, setDialogHelpAvailable, setHelpAvailable
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
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
public SaveAsDialog(Shell parentShell)
parentShell
- the parent shellprotected void configureShell(Shell shell)
Window
The default implementation of this framework method sets the shell's image and gives it a grid layout. Subclasses may extend or reimplement.
configureShell
in class Window
shell
- the shellprotected Control createContents(Composite parent)
Dialog
Dialog
implementation of this Window
method 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 the createDialogArea
and
createButtonBar
methods to create the dialog area and
button bar, respectively. Overriding createDialogArea
and
createButtonBar
are recommended rather than overriding
this method.createContents
in class TitleAreaDialog
parent
- the parent composite for the controls in this window. The type
of layout used is determined by getLayout()public boolean close()
SaveAsDialog
implementation of this Window
method disposes of the banner image when the dialog is closed.close
in class Dialog
true
if the window is (or was already) closed, and
false
if it is still openWindow.close()
protected void createButtonsForButtonBar(Composite parent)
Dialog
The Dialog
implementation of this framework method adds
standard ok and cancel buttons using the createButton
framework method. These standard buttons will be accessible from
getCancelButton
, and getOKButton
.
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.
createButtonsForButtonBar
in class Dialog
parent
- the button bar compositeprotected Control createDialogArea(Composite parent)
TitleAreaDialog
The Dialog
implementation of this framework method creates
and returns a new Composite
with no margins and spacing.
Subclasses should override.
createDialogArea
in class TitleAreaDialog
parent
- The parent composite to contain the dialog areapublic IPath getResult()
Note that the file and container might not exist and would need to be created.
See the IFile.create
method and the
ContainerGenerator
class.
null
if Cancel was pressedprotected void okPressed()
Dialog
The Dialog
implementation of this framework method sets
this dialog's return code to Window.OK
and closes the
dialog. Subclasses may override.
protected void setDialogComplete(boolean value)
value
- true
if this dialog is compelete, and
false
otherwisepublic void setOriginalFile(IFile originalFile)
originalFile
- the original filepublic void setOriginalName(String originalName)
setOriginalFile
when the original resource is not an IFile.
Must be called before create
.originalName
- default file nameprotected IDialogSettings getDialogBoundsSettings()
Dialog
getDialogBoundsSettings
in class Dialog
null
if the dialog's bounds should
never be stored.Dialog.getDialogBoundsStrategy()
protected boolean isResizable()
Dialog
false
, but also sets a style bit for a
SWT.RESIZE border, the style bit will be honored.isResizable
in class Dialog
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.