org.eclipse.graphiti.ui.editor

## Class GraphicalComposite

- 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.graphiti.ui.editor.GraphicalComposite

All Implemented Interfaces:
  java.util.EventListener, org.eclipse.gef.commands.CommandStackEventListener, org.eclipse.gef.commands.CommandStackListener, Drawable, ISelectionListener

Direct Known Subclasses:
  DiagramComposite

    public abstract class GraphicalComposite
    extends Composite
    implements org.eclipse.gef.commands.CommandStackListener, org.eclipse.gef.commands.CommandStackEventListener, ISelectionListener

Based on the original GEF GraphicalEditor class, this is a composite that supports graphical editing.

Since:
  0.10

### Field Summary

### Fields inherited from class org.eclipse.swt.widgets.Control

`view`

### Constructor Summary

Constructors
Constructor and Description
`GraphicalComposite(Composite parent, int style)` Constructs the editor part

### Method Summary

All Methods Instance Methods Concrete Methods Deprecated Methods
`void` `commandStackChanged(java.util.EventObject event)` Deprecated. Replaced by `stackChanged(CommandStackEvent)` because the class `CommandStackListener` is deprecated by GEF
`void` `createControl()` Realizes the Editor by creating it's Control.
`void` `dispose()`
`org.eclipse.gef.ui.actions.ActionRegistry` `getActionRegistry()` Lazily creates and returns the action registry.
`java.lang.Object` `getAdapter(java.lang.Class type)` Returns the adapter for the specified key.
`org.eclipse.gef.DefaultEditDomain` `getEditDomain()` Returns the edit domain.
`org.eclipse.gef.GraphicalViewer` `getGraphicalViewer()` Returns the graphical viewer.
`java.util.List` `getSelectionActions()` Returns the list of IDs of Actions that are dependant on changes in the workbench's `ISelectionService`.
`void` `hookGraphicalViewer()` Hooks the GraphicalViewer to the rest of the Editor.
`boolean` `isDirty()` Returns `true` if the command stack is dirty
`void` `selectionChanged(IWorkbenchPart part, ISelection selection)`
`void` `setEditDomain(org.eclipse.gef.DefaultEditDomain editDomain)` Sets the EditDomain for this EditorPart.
`boolean` `setFocus()`
`void` `setGraphicalViewer(org.eclipse.gef.GraphicalViewer viewer)` Sets the graphicalViewer for this EditorPart.
`void` `stackChanged(org.eclipse.gef.commands.CommandStackEvent event)` When the command stack changes, the actions interested in the command stack are updated.

### Methods inherited from class org.eclipse.swt.widgets.Composite

`changed, computeSize, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setLayout, setLayoutDeferred, setTabList`

### Methods inherited from class org.eclipse.swt.widgets.Scrollable

`computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar`

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

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

### Methods inherited from class org.eclipse.swt.widgets.Widget

`addDisposeListener, addListener, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, reskin, setData, setData, toString`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.eclipse.swt.graphics.Drawable

`isAutoScalable`

### Constructor Detail

#### GraphicalComposite

    public GraphicalComposite(Composite parent,
                              int style)

Constructs the editor part

### Method Detail

#### stackChanged

    public void stackChanged(org.eclipse.gef.commands.CommandStackEvent event)

When the command stack changes, the actions interested in the command stack are updated.

Specified by:
  `stackChanged` in interface `org.eclipse.gef.commands.CommandStackEventListener`
Parameters:
  `event` - the change event
Since:
  0.15

#### commandStackChanged

    public void commandStackChanged(java.util.EventObject event)

Deprecated. Replaced by `stackChanged(CommandStackEvent)` because the class `CommandStackListener` is deprecated by GEF
When the command stack changes, the actions interested in the command stack are updated.

Specified by:
  `commandStackChanged` in interface `org.eclipse.gef.commands.CommandStackListener`
Parameters:
  `event` - the change event

#### createControl

    public void createControl()

Realizes the Editor by creating it's Control.

WARNING: This method may or may not be called by the workbench prior to `dispose()`.

Parameters:
  `parent` - the parent composite

#### dispose

    public void dispose()

Overrides:
  `dispose` in class `Widget`
See Also:
  `IWorkbenchPart.dispose()`

#### getActionRegistry

    public org.eclipse.gef.ui.actions.ActionRegistry getActionRegistry()

Lazily creates and returns the action registry.

Returns:
  the action registry

#### getAdapter

    public java.lang.Object getAdapter(java.lang.Class type)

Returns the adapter for the specified key.

IMPORTANT certain requests, such as the property sheet, may be made before or after `#createPartControl(Composite)` is called. The order is unspecified by the Workbench.

See Also:
  `IAdaptable.getAdapter(java.lang.Class)`

#### getEditDomain

    public org.eclipse.gef.DefaultEditDomain getEditDomain()

Returns the edit domain.

Returns:
  the edit domain

#### getGraphicalViewer

    public org.eclipse.gef.GraphicalViewer getGraphicalViewer()

Returns the graphical viewer.

Returns:
  the graphical viewer

#### getSelectionActions

    public java.util.List getSelectionActions()

Returns the list of IDs of Actions that are dependant on changes in the workbench's `ISelectionService`. The associated Actions can be found in the action registry. Such actions should implement the `UpdateAction` interface so that they can be updated in response to selection changes.

Returns:
  the list of selection-dependant action IDs
See Also:
  `updateActions(List)`

#### hookGraphicalViewer

    public void hookGraphicalViewer()

Hooks the GraphicalViewer to the rest of the Editor. By default, the viewer is added to the SelectionSynchronizer, which can be used to keep 2 or more EditPartViewers in sync. The viewer is also registered as the ISelectionProvider for the Editor's PartSite.

#### isDirty

    public boolean isDirty()

Returns `true` if the command stack is dirty

See Also:
  `ISaveablePart.isDirty()`

#### selectionChanged

    public void selectionChanged(IWorkbenchPart part,
                                 ISelection selection)

Specified by:
  `selectionChanged` in interface `ISelectionListener`
See Also:
  `ISelectionListener.selectionChanged(IWorkbenchPart, ISelection)`

#### setEditDomain

    public void setEditDomain(org.eclipse.gef.DefaultEditDomain editDomain)

Sets the EditDomain for this EditorPart.

Parameters:
  `ed` - the domain

#### setFocus

    public boolean setFocus()

Overrides:
  `setFocus` in class `Composite`

#### setGraphicalViewer

    public void setGraphicalViewer(org.eclipse.gef.GraphicalViewer viewer)

Sets the graphicalViewer for this EditorPart.

Parameters:
  `viewer` - the graphical viewer