Runtime

## org.eclipse.gmf.runtime.common.ui.dialogs
Class ShowRelatedElementsDialog

    java.lang.Object
      org.eclipse.jface.window.Window
          org.eclipse.jface.dialogs.Dialog
              org.eclipse.gmf.runtime.common.ui.dialogs.ShowRelatedElementsDialog

All Implemented Interfaces:
  IShellProvider, IShowRelatedElementsWithDetails

public class ShowRelatedElementsDialog
extends Dialog
implements IShowRelatedElementsWithDetails

Show related elements dialog box, called from an action. When OK is clicked, returns Window.OK and result of the dialog is saved. When Cancel is clicked, returns Window.Cancel and result of dialog is not saved. This dialog does not include a listbox for models.

Nested Class Summary

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

Field Summary
`protected Composite` `body` Composite body that contains the interesting controls.
`protected int` `cachedExpandLevels` Cached levels of expansion -1 for indefinite.
`protected int` `cachedExpansionType` Cached expansion types.
`protected java.util.List` `cachedRelationshipTypes` Cached relationship types.
`protected boolean` `detailsShown` True if the details pane is shown, false if hidden
`protected static java.lang.String` `DIALOG_SETTINGS_KEY` Dialog settings key True if the details pane is shown, false if hidden
`static int` `MAX_VIEWER_WIDTH` Tree viewer control's width for the hint
`protected Composite` `placeholderForShowRelatedElementsComposite` Predefined composite placeholder.
`protected int` `preferredViewerWidth` Preferred viewer width, cached
`protected java.util.List` `queriesList` List of queries.
`protected ShowRelatedElementsPredefinedComposite` `showRelatedElementsPredefinedComposite` Predefined composite.

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
`ShowRelatedElementsDialog(Shell parentShell, SelectableElement aRootElement)` Constructor takes the parent shell and root SelectableElement to add into the viewer.
`ShowRelatedElementsDialog(Shell parentShell, SelectableElement aRootElement, java.util.List aQueriesList)` Constructor takes the parent shell and root SelectableElement to add into the viewer.

Method Summary
`protected void` `cancelPressed()` Cancel button click handler Dialog is not closed if validation fails.
`boolean` `close()` Save settings before close
`protected Control` `createContents(Composite parent)` Create contents and give focus to the OK button
`protected Control` `createDialogArea(Composite parent)` Make the composites in the dialog
`void` `detailsChanged()` Notify the composite the details were changed
`boolean` `getConsumerToSelection()` Returns if the selection to consumer radio or both radio was selected This will be deprecated when all SRE implementors implement the all connected option.
`ShowRelatedElementsPreset` `getCurrentSettings()` Return the current preset settings
`boolean` `getExpandIndefinitely()` Returns if the expand indefinitely box was checked, even if it is disposed.
`int` `getExpandLevels()` Returns the int value in the expand levels box, even if it is disposed and even if the user did not enter an int.
`ExpansionType` `getExpansionType()` Returns the expansion type
`protected ShowRelatedElementsPredefinedComposite` `getPredefinedComposite()` Return the predefined composite.
`protected int` `getPreferredViewerWidth()` Cache the preferred viewer width after figuring it out from the longest string length of the root element.
`SelectableElement` `getRootElement()` Returns the root element of the RelatedElements that were in the viewer control at the left of the dialog.
`java.util.List` `getSelectedRelationshipTypes()` Returns list of selected RelationshipTypes.
`boolean` `getSelectionToSupplier()` Returns if the selection to supplier radio or both radio was selected This will be deprecated when all SRE implementors implement the all connected option.
`ShowRelatedElementsComposite` `getShowRelatedElementsComposite()` Method getShowRelatedElementsComposite.
`protected void` `initDialogSettings()` Read in dialog settings and update based on that.
`void` `initHelpContextId(java.lang.String helpId)` Initialize the context sensitive help id.
`protected ShowRelatedElementsPredefinedComposite` `makePredefinedComposite(Composite parent, SelectableElement root, java.util.List queries, int viewerWidth)` Make the predefined composite
`protected ShowRelatedElementsComposite` `makeShowRelatedElementsComposite(Composite parent, SelectableElement root, int aViewerWidth)` Make the show related elements composite
`protected ShowRelatedElementsComposite` `makeShowRelatedElementsCompositeInPlaceholder(Composite parent, SelectableElement root)` Suggested that you override makeShowRelatedElementsComposite instead, unless you have a good reason for overriding the plcaeholder composite too.
`protected void` `okPressed()` OK button click handler.
`protected void` `saveCachedValues()` Save the cached values of the composite in our own cache.
`protected void` `saveDialogSettings()` Store the dialog settings from our current dialog.
`void` `showOrHideDetails()` Toggle showing or hiding details.
`void` `updateRelationships(ShowRelatedElementsPreset preset)` Update relationshpips according to the preset

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

`applyDialogFont, buttonPressed, convertHeightInCharsToPixels, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, convertWidthInCharsToPixels, create, createButton, createButtonBar, createButtonsForButtonBar, dialogFontIsDefault, getBlockedHandler, getButton, getButtonBar, getCancelButton, getDialogArea, getDialogBoundsSettings, getDialogBoundsStrategy, getImage, getInitialLocation, getInitialSize, getOKButton, initializeBounds, initializeDialogUnits, setBlockedHandler, setButtonLayoutData, setButtonLayoutFormData, shortenText`

Methods inherited from class org.eclipse.jface.window.Window

`canHandleShellCloseEvent, configureShell, 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

### detailsShown

    protected boolean detailsShown

  True if the details pane is shown, false if hidden

### DIALOG_SETTINGS_KEY

    protected static final java.lang.String DIALOG_SETTINGS_KEY

  Dialog settings key True if the details pane is shown, false if hidden

  See Also:
    Constant Field Values

### queriesList

    protected java.util.List queriesList

  List of queries.

### cachedExpandLevels

    protected int cachedExpandLevels

  Cached levels of expansion -1 for indefinite. Default 1

### cachedExpansionType

    protected int cachedExpansionType

  Cached expansion types. See ExpansionTypes for values. Default both

### cachedRelationshipTypes

    protected java.util.List cachedRelationshipTypes

  Cached relationship types.

### placeholderForShowRelatedElementsComposite

    protected Composite placeholderForShowRelatedElementsComposite

  Predefined composite placeholder.

### showRelatedElementsPredefinedComposite

    protected ShowRelatedElementsPredefinedComposite showRelatedElementsPredefinedComposite

  Predefined composite.

### body

    protected Composite body

  Composite body that contains the interesting controls.

### preferredViewerWidth

    protected int preferredViewerWidth

  Preferred viewer width, cached

### MAX_VIEWER_WIDTH

    public static int MAX_VIEWER_WIDTH

  Tree viewer control's width for the hint

Constructor Detail

### ShowRelatedElementsDialog

    public ShowRelatedElementsDialog(Shell parentShell,
                                     SelectableElement aRootElement)

  Constructor takes the parent shell and root SelectableElement to add into the viewer.

Parameters:
  `parentShell` - the parent Shell
  `aRootElement` - the root SelectableElement to add into the viewer

### ShowRelatedElementsDialog

    public ShowRelatedElementsDialog(Shell parentShell,
                                     SelectableElement aRootElement,
                                     java.util.List aQueriesList)

  Constructor takes the parent shell and root SelectableElement to add into the viewer. It also sets a list of predefined queries.

Parameters:
  `parentShell` - the parent Shell
  `aRootElement` - the root SelectableElement to add into the viewer
  `aQueriesList` - list of hardcoded queries

Method Detail

### makePredefinedComposite

    protected ShowRelatedElementsPredefinedComposite makePredefinedComposite(Composite parent,
                                                                             SelectableElement root,
                                                                             java.util.List queries,
                                                                             int viewerWidth)

  Make the predefined composite

  Parameters:
    `parent` - parent Composite
    `root` - root SelectableElement
    `queries` - saved queries List
    `viewerWidth` - desired width of listbox viewer
  Returns:
    the predefined queries composite

### getPreferredViewerWidth

    protected int getPreferredViewerWidth()

  Cache the preferred viewer width after figuring it out from the longest string length of the root element.

  Returns:
    int, preferred viewer width

### makeShowRelatedElementsCompositeInPlaceholder

    protected ShowRelatedElementsComposite makeShowRelatedElementsCompositeInPlaceholder(Composite parent,
                                                                                         SelectableElement root)

  Suggested that you override makeShowRelatedElementsComposite instead, unless you have a good reason for overriding the plcaeholder composite too.

  Parameters:
    `parent` - the parent Composite that we will be adding the placeholder into
    `root` - root SelectableElement
  Returns:
    the composite that we made inside a placeholder

### makeShowRelatedElementsComposite

    protected ShowRelatedElementsComposite makeShowRelatedElementsComposite(Composite parent,
                                                                            SelectableElement root,
                                                                            int aViewerWidth)

  Make the show related elements composite

  Parameters:
    `parent` - parent Composite we will be adding into.
    `root` - root SelectableElement
    `aViewerWidth` - int hint for viewer width
  Returns:
    the composite that we made

### createDialogArea

    protected Control createDialogArea(Composite parent)

  Make the composites in the dialog

  Parameters:
    `parent` - the parent Composite
  Returns:
    the parent Composite

### createContents

    protected Control createContents(Composite parent)

  Create contents and give focus to the OK button

  Parameters:
    `parent` - the parent Composite
  Returns:
    Control created from superclass

### okPressed

    protected void okPressed()

  OK button click handler. Dialog is not closed if validation fails. Otherwise, the dialog closes.

### cancelPressed

    protected void cancelPressed()

  Cancel button click handler Dialog is not closed if validation fails. Otherwise, the dialog closes.

### getExpandIndefinitely

    public boolean getExpandIndefinitely()

  Returns if the expand indefinitely box was checked, even if it is disposed.

  Returns:
    true if checked, false if not checked

### getExpandLevels

    public int getExpandLevels()

  Returns the int value in the expand levels box, even if it is disposed and even if the user did not enter an int.

  Returns:
    int with the number of expand levels. 1 is returned if the user did not enter an int and this was not caught earlier.

### getConsumerToSelection

    public boolean getConsumerToSelection()

  Returns if the selection to consumer radio or both radio was selected This will be deprecated when all SRE implementors implement the all connected option. Use getExpansionType() instead.

  Returns:
    true if selected, false if not selected

### getSelectionToSupplier

    public boolean getSelectionToSupplier()

  Returns if the selection to supplier radio or both radio was selected This will be deprecated when all SRE implementors implement the all connected option. Use getExpansionType() instead.

  Returns:
    true if selected, false if not selected

### getExpansionType

    public ExpansionType getExpansionType()

  Returns the expansion type

  Returns:
    true if selected, false if not selected

### getSelectedRelationshipTypes

    public java.util.List getSelectedRelationshipTypes()

  Returns list of selected RelationshipTypes.

  Returns:
    List of relationship types that were from SelectableElement objects under the root that had a SelectedType of SELECTED.

### getRootElement

    public SelectableElement getRootElement()

  Returns the root element of the RelatedElements that were in the viewer control at the left of the dialog.

  Returns:
    SelectableElement with the root element.

### getShowRelatedElementsComposite

    public ShowRelatedElementsComposite getShowRelatedElementsComposite()

  Method getShowRelatedElementsComposite.

  Returns:
    the ShowRelatedElementsComposite contained in the dialog

### initHelpContextId

    public void initHelpContextId(java.lang.String helpId)

  Initialize the context sensitive help id.

  Parameters:
    `helpId` - the help context id string

### saveCachedValues

    protected void saveCachedValues()

  Save the cached values of the composite in our own cache.

### showOrHideDetails

    public void showOrHideDetails()

  Toggle showing or hiding details.

  Specified by:
    `showOrHideDetails` in interface `IShowRelatedElementsWithDetails`

### updateRelationships

    public void updateRelationships(ShowRelatedElementsPreset preset)

  Update relationshpips according to the preset

  Specified by:
    `updateRelationships` in interface `IShowRelatedElementsWithDetails`
  Parameters:
    `preset` - ShowRelatedElementsPreset containing new relationhips.

### getCurrentSettings

    public ShowRelatedElementsPreset getCurrentSettings()

  Return the current preset settings

  Specified by:
    `getCurrentSettings` in interface `IShowRelatedElementsWithDetails`
  Returns:
    custom ShowRelatedElementsPreset settings

### detailsChanged

    public void detailsChanged()

  Notify the composite the details were changed

  Specified by:
    `detailsChanged` in interface `IShowRelatedElementsWithDetails`

### getPredefinedComposite

    protected ShowRelatedElementsPredefinedComposite getPredefinedComposite()

  Return the predefined composite.

  Returns:
    the ShowRelatedElementsPredefinedComposite

### initDialogSettings

    protected void initDialogSettings()

  Read in dialog settings and update based on that. For now, only take care of the detailsShown instance variable for deciding whether or not we should show the details pane.

### saveDialogSettings

    protected void saveDialogSettings()

  Store the dialog settings from our current dialog. For now, only take care of the detailsShown instance variable for deciding whether or not we should show the details pane.

### close

    public boolean close()

  Save settings before close

  Returns:
    boolean, superclass result

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.