public class ResourceDialog
extends Dialog
Subclasses are encouraged to override processResources()
, where they can process
the specified URIs.
Modifier and Type | Field and Description |
---|---|
protected URI |
context |
protected static int |
CONTROL_OFFSET |
protected int |
style |
protected java.lang.String |
title |
protected Text |
uriField |
protected java.lang.String |
uriText |
Constructor and Description |
---|
ResourceDialog(Shell parent,
java.lang.String title,
int style)
Creates a new instance of this class, given a parent shell, an optional title, and a style value
describing its behaviour.
|
ResourceDialog(Shell parent,
java.lang.String title,
int style,
URI context)
Creates a new instance of this class, given a parent shell, an optional title, a style value describing its behaviour, and a context URI.
|
Modifier and Type | Method and Description |
---|---|
protected void |
configureShell(Shell shell) |
protected Control |
createDialogArea(Composite parent)
Creates and returns the contents of the upper part of this dialog.
|
java.util.List<URI> |
getURIs()
Returns the list of space-separated URIs from the URI text field.
|
java.lang.String |
getURIText()
Returns the value of the URI text field.
|
protected boolean |
isMulti() |
protected boolean |
isSave() |
protected void |
normalizeStyle() |
protected void |
okPressed()
Called when the OK button has been pressed, this method calls
getURIText() to cache and return
the URI text field's value (so that it may be retrieved even after the field has been disposed). |
protected void |
prepareBrowseFileSystemButton(Button browseFileSystemButton)
Called to prepare the Browse File System button, this implementation adds a selection listener
that creates an appropriate
FileDialog . |
protected void |
prepareBrowseWorkspaceButton(Button browseWorkspaceButton)
Called to prepare the Browse Workspace button, this implementation adds a selection listener
that creates an appropriate
WorkspaceResourceDialog . |
protected boolean |
processResources()
Called by
okPressed() to handle the specified URIs, this implementation simply returns true, allowing
the dialog to close. |
protected static final int CONTROL_OFFSET
protected java.lang.String title
protected int style
protected Text uriField
protected java.lang.String uriText
protected URI context
public ResourceDialog(Shell parent, java.lang.String title, int style)
parent
- a shell which will be the parent of the new instancetitle
- an optional title for the dialog, to be used in place of the defaultstyle
- SWT style bits
, indicating whether existing (SWT.OPEN
)
or new (SWT.SAVE)
resources are to be specified and, in the former case, whether
single (SWT.SINGLE
)
or multiple (SWT.MULTI
)
.
Open existing and single resource are the defaults.public ResourceDialog(Shell parent, java.lang.String title, int style, URI context)
parent
- a shell which will be the parent of the new instancetitle
- an optional title for the dialog, to be used in place of the defaultstyle
- SWT style bits
, indicating whether existing (SWT.OPEN
)
or new (SWT.SAVE)
resources are to be specified and,
in the former case, whether single (SWT.SINGLE
)
or multiple (SWT.MULTI
)
.
Open existing and single resource are the defaults.context
- a context to use in setting the initial selection when browsing the workspace.
If non-null, this should be a platform resource URI referring to the active file. Its container will be selected by default.protected void normalizeStyle()
protected boolean isSave()
protected boolean isMulti()
protected void configureShell(Shell shell)
protected Control createDialogArea(Composite parent)
prepareBrowseFileSystemButton(Button)
and prepareBrowseWorkspaceButton(Button)
, respectively.protected void prepareBrowseFileSystemButton(Button browseFileSystemButton)
FileDialog
.protected void prepareBrowseWorkspaceButton(Button browseWorkspaceButton)
WorkspaceResourceDialog
.protected void okPressed()
getURIText()
to cache and return
the URI text field's value (so that it may be retrieved even after the field has been disposed).
It then calls processResources()
to handle the specified URIs and optionally closes the dialog,
based on its return value.public java.lang.String getURIText()
public java.util.List<URI> getURIs()
protected boolean processResources()
okPressed()
to handle the specified URIs, this implementation simply returns true, allowing
the dialog to close. Subclasses can override this method to load, save, or otherwise process resources, and
based on this processing, to optionally prevent the dialog from being closed if the URIs are invalid.true
if the dialog can be closed, false
if URI(s) must be re-entered