## org.eclipse.emf.common.ui.dialogs
Class ResourceDialog

    java.lang.Object
      org.eclipse.jface.window.Window
          org.eclipse.jface.dialogs.Dialog
              org.eclipse.emf.common.ui.dialogs.ResourceDialog

All Implemented Interfaces:
  IShellProvider

Direct Known Subclasses:
  ControlAction.ControlResourceDialog, LoadResourceAction.LoadResourceDialog

    public class ResourceDialog

extends Dialog

Instances of this class allow a user to specify one or more URIs identifying resources. The dialog includes buttons that allow the file system or workspace to be browsed, so that the URI can be automatically filled based on the selected file.

Subclasses are encouraged to override `processResources()`, where they can process the specified URIs.

Since:
  2.2.0

Nested Class Summary

Nested classes/interfaces inherited from class org.eclipse.jface.window.Window
`Window.IExceptionHandler`

Field Summary
`protected static int` `CONTROL_OFFSET`
`protected int` `style`
`protected java.lang.String` `title`
`protected Text` `uriField`
`protected java.lang.String` `uriText`

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`

Constructor Summary
`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.

Method Summary
`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.

Methods inherited from class org.eclipse.jface.dialogs.Dialog

`applyDialogFont, buttonPressed, cancelPressed, close, convertHeightInCharsToPixels, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, convertWidthInCharsToPixels, create, createButton, createButtonBar, createButtonsForButtonBar, createContents, dialogFontIsDefault, getBlockedHandler, getButton, getButtonBar, getCancelButton, getDialogArea, getDialogBoundsSettings, getDialogBoundsStrategy, getImage, getInitialLocation, getInitialSize, getOKButton, initializeBounds, initializeDialogUnits, isResizable, 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`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### CONTROL_OFFSET

    protected static final int CONTROL_OFFSET

See Also:
  Constant Field Values

### title

    protected java.lang.String title

### style

    protected int style

### uriField

    protected Text uriField

### uriText

    protected java.lang.String uriText

Constructor Detail

### ResourceDialog

    public 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.

  Parameters:
    `parent` - a shell which will be the parent of the new instance
    `title` - an optional title for the dialog, to be used in place of the default
    `style` - `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.

Method Detail

### normalizeStyle

    protected void normalizeStyle()

### isSave

    protected boolean isSave()

### isMulti

    protected boolean isMulti()

### configureShell

    protected void configureShell(Shell shell)

  Overrides:
    `configureShell` in class `Window`

### createDialogArea

    protected Control createDialogArea(Composite parent)

  Creates and returns the contents of the upper part of this dialog. This implementation creates a labeled text field for the URI(s) and buttons for browsing the file system and workspace. These buttons are configured (selection listeners are added) by calling `prepareBrowseFileSystemButton(org.eclipse.swt.widgets.Button)` and `prepareBrowseWorkspaceButton(org.eclipse.swt.widgets.Button)`, respectively.

  Overrides:
    `createDialogArea` in class `Dialog`

### prepareBrowseFileSystemButton

    protected void prepareBrowseFileSystemButton(Button browseFileSystemButton)

  Called to prepare the Browse File System button, this implementation adds a selection listener that creates an appropriate `FileDialog`.

### prepareBrowseWorkspaceButton

    protected void prepareBrowseWorkspaceButton(Button browseWorkspaceButton)

  Called to prepare the Browse Workspace button, this implementation adds a selection listener that creates an appropriate `WorkspaceResourceDialog`.

### okPressed

    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). It then calls `processResources()` to handle the specified URIs and optionally closes the dialog, based on its return value.

  Overrides:
    `okPressed` in class `Dialog`

### getURIText

    public java.lang.String getURIText()

  Returns the value of the URI text field.

### getURIs

    public java.util.List<URI> getURIs()

  Returns the list of space-separated URIs from the URI text field.

### processResources

    protected boolean processResources()

  Called by `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.

  Returns:
    `true` if the dialog can be closed, `false` if URI(s) must be re-entered

Copyright 2001-2006 IBM Corporation and others. All Rights Reserved.