## org.eclipse.emf.ecoretools.diagram.ui.outline
Class AbstractModelNavigator

    java.lang.Object
      org.eclipse.swt.widgets.Widget
          org.eclipse.swt.widgets.Control
              org.eclipse.swt.widgets.Scrollable
                  org.eclipse.swt.widgets.Composite
                      org.eclipse.emf.ecoretools.diagram.ui.outline.AbstractModelNavigator

All Implemented Interfaces:
  org.eclipse.jface.action.IMenuListener, org.eclipse.swt.graphics.Drawable

    public abstract class AbstractModelNavigator

extends org.eclipse.swt.widgets.Composite
implements org.eclipse.jface.action.IMenuListener

Model navigator :
Display the model as a tree and fill the contextual menu with diagrams and EMF actions.
Updated : 18 feb. 2008

Nested Class Summary
`protected class` `AbstractModelNavigator.NavigatorAdapterFactoryContentProvider` This content provider filters the event from graphical object to only refresh when it's needed.

Field Summary

Fields inherited from class org.eclipse.swt.widgets.Composite
`embeddedHandle`

Fields inherited from class org.eclipse.swt.widgets.Widget
`handle`

Constructor Summary
`AbstractModelNavigator(org.eclipse.swt.widgets.Composite parent, org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart diagEditor, org.eclipse.ui.part.IPageSite pageSite)` Constructor

Method Summary
`protected void` `createContents(org.eclipse.swt.widgets.Composite parent)` Create the contents of the widget
`protected void` `createContextMenu(org.eclipse.jface.viewers.StructuredViewer sViewer)` This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
`protected void` `createDiagramsMenu(org.eclipse.jface.action.IMenuManager manager, org.eclipse.emf.ecore.EObject selectedObject)` Subclasses should override this method to add their own actions related to Diagram stuff
`protected void` `createEMFMenu(org.eclipse.jface.action.IMenuManager manager, org.eclipse.emf.ecore.EObject selectedObject)` Subclasses should override this method to add/remove actions related to EMF stuff
`protected void` `createMultiSelectionMenu(org.eclipse.jface.action.IMenuManager manager, org.eclipse.jface.viewers.IStructuredSelection selection)` Add to the MenuManager the actions for a multiple selection.
`void` `dispose()`
`protected abstract org.eclipse.emf.common.notify.AdapterFactory` `getAdapterFactory()` Get the AdapterFactory associated with an editor
`protected org.eclipse.emf.ecore.resource.Resource` `getDiagramResource()` The diagram model Resource
`protected org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart` `getEditor()` Return the IDiagramWorkbenchPart
`protected org.eclipse.emf.ecore.resource.Resource` `getModelResource()` The domain model Resource
`org.eclipse.jface.viewers.TreeViewer` `getTreeViewer()` Returns the TreeViewer used as navigator
`protected void` `hookKeyListeners()` Add a key listener to the tree control.
`protected void` `hookListeners()` Add listeners : - on the model
`protected void` `initDragAndDrop()` Add drag and drop ability between the outline to the editor.
`protected void` `initFilters()` Set the tree filters for the outline
`protected void` `initProviders()` Set the tree providers for the outline
`protected boolean` `isControlActionEnabledFor(org.eclipse.emf.ecore.EObject selectedObject)` Subclasses should override this method to control enabling/disabling the control action for the current selection.
`protected boolean` `isDiagramsMenuEnabledFor(org.eclipse.emf.ecore.EObject selectedObject)` Subclasses should override this method to control enabling/disabling the Diagrams menu for the current selection.
`protected boolean` `isEMFMenuEnabledFor(org.eclipse.emf.ecore.EObject selectedObject)` Subclasses should override this method to control enabling/disabling the EMF menu for the current selection.
`void` `menuAboutToShow(org.eclipse.jface.action.IMenuManager menuManager)` This implements `IMenuListener`to help fill the context menus with contributions from the Edit menu.
`protected void` `refreshViewer()` Refresh the tree viewer in the UI thread if we are in a different thread
`protected void` `refreshViewer(boolean updateLabel)` Refresh the tree viewer in the UI thread if we are in a different thread
`protected void` `unhookListeners()` Remove listeners

Methods inherited from class org.eclipse.swt.widgets.Composite
`changed, checkSubclass, computeSize, getBackgroundMode, getChildren, getClientArea, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList`

Methods inherited from class org.eclipse.swt.widgets.Scrollable
`computeTrim, getBorderWidth, getHorizontalBar, getVerticalBar`

Methods inherited from class org.eclipse.swt.widgets.Control

`addControlListener, addDragDetectListener, addFocusListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBounds, getCursor, getData, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getRegion, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTraverseListener, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setRegion, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update`

Methods inherited from class org.eclipse.swt.widgets.Widget
`addDisposeListener, addListener, checkWidget, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString`

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

Constructor Detail

### AbstractModelNavigator

    public AbstractModelNavigator(org.eclipse.swt.widgets.Composite parent,
                                  org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart diagEditor,
                                  org.eclipse.ui.part.IPageSite pageSite)

  Constructor

  Parameters:
    `parent` - the parent composite
    `diagEditor` - the viewer to edit as tree
    `pageSite` - the site

Method Detail

### getTreeViewer

    public org.eclipse.jface.viewers.TreeViewer getTreeViewer()

  Returns the TreeViewer used as navigator

  Returns:
    the navigable tree

### createContents

    protected void createContents(org.eclipse.swt.widgets.Composite parent)

  Create the contents of the widget

  Parameters:
    `parent` - the current widget

### getDiagramResource

    protected org.eclipse.emf.ecore.resource.Resource getDiagramResource()

  The diagram model Resource

  Returns:
    Resource

### getModelResource

    protected org.eclipse.emf.ecore.resource.Resource getModelResource()

  The domain model Resource

  Returns:
    Resource

### initDragAndDrop

    protected void initDragAndDrop()

  Add drag and drop ability between the outline to the editor.

### initProviders

    protected void initProviders()

  Set the tree providers for the outline

### initFilters

    protected void initFilters()

  Set the tree filters for the outline

### hookListeners

    protected void hookListeners()

  Add listeners :
  - on the model

### unhookListeners

    protected void unhookListeners()

  Remove listeners

### hookKeyListeners

    protected void hookKeyListeners()

  Add a key listener to the tree control. When a key is released, the DELETE key is filtered to fire the action.

### createContextMenu

    protected void createContextMenu(org.eclipse.jface.viewers.StructuredViewer sViewer)

  This creates a context menu for the viewer and adds a listener as well registering the menu for extension.

  Parameters:
    `sViewer` - the tree viewer

### menuAboutToShow

    public void menuAboutToShow(org.eclipse.jface.action.IMenuManager menuManager)

  This implements `IMenuListener`to help fill the context menus with contributions from the Edit menu.

  Specified by:
    `menuAboutToShow` in interface `org.eclipse.jface.action.IMenuListener`
  Parameters:
    `menuManager` - the menu to fill

### createMultiSelectionMenu

    protected void createMultiSelectionMenu(org.eclipse.jface.action.IMenuManager manager,
                                            org.eclipse.jface.viewers.IStructuredSelection selection)

  Add to the MenuManager the actions for a multiple selection.

  Parameters:
    `manager` - The menu to fill
    `selection` - the selection

### isEMFMenuEnabledFor

    protected boolean isEMFMenuEnabledFor(org.eclipse.emf.ecore.EObject selectedObject)

  Subclasses should override this method to control enabling/disabling the EMF menu for the current selection. Default returns true.

  Parameters:
    `selectedObject` -
  Returns:
    whether the control action is enabled for the current selection or not.

### createEMFMenu

    protected void createEMFMenu(org.eclipse.jface.action.IMenuManager manager,
                                 org.eclipse.emf.ecore.EObject selectedObject)

  Subclasses should override this method to add/remove actions related to EMF stuff

  Parameters:
    `manager` - the IMenuManager
    `selectedObject` - the selected model object

### isDiagramsMenuEnabledFor

    protected boolean isDiagramsMenuEnabledFor(org.eclipse.emf.ecore.EObject selectedObject)

  Subclasses should override this method to control enabling/disabling the Diagrams menu for the current selection. Default returns true.

  Parameters:
    `selectedObject` -
  Returns:
    whether the control action is enabled for the current selection or not.

### createDiagramsMenu

    protected void createDiagramsMenu(org.eclipse.jface.action.IMenuManager manager,
                                      org.eclipse.emf.ecore.EObject selectedObject)

  Subclasses should override this method to add their own actions related to Diagram stuff

  Parameters:
    `manager` - the IMenuManager
    `selectedObject` - the selected model object

### isControlActionEnabledFor

    protected boolean isControlActionEnabledFor(org.eclipse.emf.ecore.EObject selectedObject)

  Subclasses should override this method to control enabling/disabling the control action for the current selection. Default returns true.

  Parameters:
    `selectedObject` -
  Returns:
    whether the control action is enabled for the current selection or not.

### refreshViewer

    protected final void refreshViewer()

  Refresh the tree viewer in the UI thread if we are in a different thread

### refreshViewer

    protected final void refreshViewer(boolean updateLabel)

  Refresh the tree viewer in the UI thread if we are in a different thread

  Parameters:
    `updateLabel` - `true` if the label must be refreshed

### dispose

    public void dispose()

  Overrides:
    `dispose` in class `org.eclipse.swt.widgets.Widget`
  See Also:
    `Widget.dispose()`

### getEditor

    protected org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart getEditor()

  Return the IDiagramWorkbenchPart

  Returns:
    IDiagramWorkbenchPart

### getAdapterFactory

    protected abstract org.eclipse.emf.common.notify.AdapterFactory getAdapterFactory()

  Get the AdapterFactory associated with an editor

  Returns:
    AdapterFactory

Copyright 2007 Anyware Technologies. All Rights Reserved.