Package 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:
EventListener,org.eclipse.gef.commands.CommandStackEventListener,org.eclipse.gef.commands.CommandStackListener,org.eclipse.swt.graphics.Drawable,org.eclipse.ui.ISelectionListener
- Direct Known Subclasses:
DiagramComposite
public abstract class GraphicalComposite
extends org.eclipse.swt.widgets.Composite
implements org.eclipse.gef.commands.CommandStackListener, org.eclipse.gef.commands.CommandStackEventListener, org.eclipse.ui.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
handleFields inherited from class org.eclipse.swt.widgets.Widget
nativeZoom -
Constructor Summary
ConstructorsConstructorDescriptionGraphicalComposite(org.eclipse.swt.widgets.Composite parent, int style) Constructs the editor part -
Method Summary
Modifier and TypeMethodDescriptionvoidcommandStackChanged(EventObject event) Deprecated.protected voidCalled to configure the graphical viewer before it receives its contents.protected voidCreates actions for this editor.voidRealizes the Editor by creating it's Control.protected voidCreates the GraphicalViewer on the specifiedComposite.voiddispose()protected voidfirePropertyChange(int property) org.eclipse.gef.ui.actions.ActionRegistryLazily creates and returns the action registry.getAdapter(Class type) Returns the adapter for the specified key.protected org.eclipse.gef.commands.CommandStackReturns the command stack.org.eclipse.gef.DefaultEditDomainReturns the edit domain.org.eclipse.gef.GraphicalViewerReturns the graphical viewer.protected ListReturns the list ofIActionsdependant on property changes in the Editor.Returns the list of IDs of Actions that are dependant on changes in the workbench'sISelectionService.protected org.eclipse.gef.ui.parts.SelectionSynchronizerReturns the selection syncronizer object.protected ListReturns the list of IDs of Actions that are dependant on the CommmandStack's state.protected abstract org.eclipse.ui.IWorkbenchPartvoidHooks the GraphicalViewer to the rest of the Editor.protected voidinit()protected voidInitializes the ActionRegistry.protected voidOverride to set the contents of the GraphicalViewer after it has been created.booleanisDirty()Returnstrueif the command stack is dirtyvoidselectionChanged(org.eclipse.ui.IWorkbenchPart part, org.eclipse.jface.viewers.ISelection selection) protected voidsetActionRegistry(org.eclipse.gef.ui.actions.ActionRegistry registry) Sets the ActionRegistry for this EditorPart.voidsetEditDomain(org.eclipse.gef.DefaultEditDomain editDomain) Sets the EditDomain for this EditorPart.booleansetFocus()voidsetGraphicalViewer(org.eclipse.gef.GraphicalViewer viewer) Sets the graphicalViewer for this EditorPart.voidstackChanged(org.eclipse.gef.commands.CommandStackEvent event) When the command stack changes, the actions interested in the command stack are updated.protected voidupdateActions(List actionIds) A convenience method for updating a set of actions defined by the given List of action IDs.Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setLayout, setLayoutDeferred, setTabList, toStringMethods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar, setScrollbarsModeMethods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, 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, updateMethods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, addTypedListener, checkWidget, getData, getData, getDisplay, getListeners, getStyle, getTypedListeners, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, removeTypedListener, reskin, setData, setDataMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.swt.graphics.Drawable
isAutoScalable
-
Constructor Details
-
GraphicalComposite
public GraphicalComposite(org.eclipse.swt.widgets.Composite parent, int style) Constructs the editor part
-
-
Method Details
-
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:
stackChangedin interfaceorg.eclipse.gef.commands.CommandStackEventListener- Parameters:
event- the change event- Since:
- 0.15
-
commandStackChanged
Deprecated.Replaced bystackChanged(CommandStackEvent)because the classCommandStackListeneris deprecated by GEFWhen the command stack changes, the actions interested in the command stack are updated.- Specified by:
commandStackChangedin interfaceorg.eclipse.gef.commands.CommandStackListener- Parameters:
event- the change event
-
configureGraphicalViewer
protected void configureGraphicalViewer()Called to configure the graphical viewer before it receives its contents. This is where the root editpart should be configured. Subclasses should extend or override this method as needed. -
createActions
protected void createActions()Creates actions for this editor. Subclasses should override this method to create and register actions with theActionRegistry. -
createGraphicalViewer
protected void createGraphicalViewer()Creates the GraphicalViewer on the specifiedComposite.- Parameters:
parent- the parent composite
-
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:
disposein classorg.eclipse.swt.widgets.Widget- See Also:
-
IWorkbenchPart.dispose()
-
firePropertyChange
protected void firePropertyChange(int property) - See Also:
-
WorkbenchPart.firePropertyChange(int)
-
getActionRegistry
public org.eclipse.gef.ui.actions.ActionRegistry getActionRegistry()Lazily creates and returns the action registry.- Returns:
- the action registry
-
getAdapter
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)
-
getCommandStack
protected org.eclipse.gef.commands.CommandStack getCommandStack()Returns the command stack.- Returns:
- the command stack
-
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
-
getPropertyActions
Returns the list ofIActionsdependant on property changes in the Editor. These actions should implement theUpdateActioninterface so that they can be updated in response to property changes. An example is the "Save" action.- Returns:
- the list of property-dependant actions
-
getSelectionActions
Returns the list of IDs of Actions that are dependant on changes in the workbench'sISelectionService. The associated Actions can be found in the action registry. Such actions should implement theUpdateActioninterface so that they can be updated in response to selection changes.- Returns:
- the list of selection-dependant action IDs
- See Also:
-
getSelectionSynchronizer
protected org.eclipse.gef.ui.parts.SelectionSynchronizer getSelectionSynchronizer()Returns the selection syncronizer object. The synchronizer can be used to sync the selection of 2 or more EditPartViewers.- Returns:
- the syncrhonizer
-
getStackActions
Returns the list of IDs of Actions that are dependant on the CommmandStack's state. The associated Actions can be found in the action registry. These actions should implement theUpdateActioninterface so that they can be updated in response to command stack changes. An example is the "undo" action.- Returns:
- the list of stack-dependant action IDs
-
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. -
init
protected void init() -
initializeActionRegistry
protected void initializeActionRegistry()Initializes the ActionRegistry. This registry may be used byActionBarContributorsand/orContextMenuProviders.This method may be called on Editor creation, or lazily the first time
getActionRegistry()is called. -
initializeGraphicalViewer
protected void initializeGraphicalViewer()Override to set the contents of the GraphicalViewer after it has been created.- See Also:
-
#createGraphicalViewer(Composite)
-
isDirty
public boolean isDirty()Returnstrueif the command stack is dirty- See Also:
-
ISaveablePart.isDirty()
-
selectionChanged
public void selectionChanged(org.eclipse.ui.IWorkbenchPart part, org.eclipse.jface.viewers.ISelection selection) - Specified by:
selectionChangedin interfaceorg.eclipse.ui.ISelectionListener- See Also:
-
ISelectionListener.selectionChanged(IWorkbenchPart, ISelection)
-
setActionRegistry
protected void setActionRegistry(org.eclipse.gef.ui.actions.ActionRegistry registry) Sets the ActionRegistry for this EditorPart.- Parameters:
registry- the registry
-
setEditDomain
public void setEditDomain(org.eclipse.gef.DefaultEditDomain editDomain) Sets the EditDomain for this EditorPart.- Parameters:
ed- the domain
-
setFocus
public boolean setFocus()- Overrides:
setFocusin classorg.eclipse.swt.widgets.Composite
-
setGraphicalViewer
public void setGraphicalViewer(org.eclipse.gef.GraphicalViewer viewer) Sets the graphicalViewer for this EditorPart.- Parameters:
viewer- the graphical viewer
-
updateActions
A convenience method for updating a set of actions defined by the given List of action IDs. The actions are found by looking up the ID in theaction registry. If the corresponding action is anUpdateAction, it will have itsupdate()method called.- Parameters:
actionIds- the list of IDs to update
-
getWorkbenchPart
protected abstract org.eclipse.ui.IWorkbenchPart getWorkbenchPart()
-
stackChanged(CommandStackEvent)because the classCommandStackListeneris deprecated by GEF