Package org.eclipse.graphiti.ui.editor
Class DiagramComposite
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
org.eclipse.graphiti.ui.editor.DiagramComposite
- All Implemented Interfaces:
- EventListener,- org.eclipse.core.runtime.IAdaptable,- org.eclipse.gef.commands.CommandStackEventListener,- org.eclipse.gef.commands.CommandStackListener,- IDiagramContainer,- IDiagramContainerUI,- org.eclipse.swt.graphics.Drawable,- org.eclipse.ui.ISelectionListener
An SWT composite that can display a Graphiti diagram. This implementation is
 based on a custom 
GraphicalComposite class that works much like the
 GEF GraphicalEditorWithFlyoutPalette class.
 
 A DiagramComposite can be used anywhere a regular SWT Composite can. A
 DiagramComposite can participate in a parent transaction or create one of
 it's own. If the DiagramComposites is managing it's own transaction, it is up
 to the enclosing workbench part to call the appropriate methods on the
 composite.- Since:
- 0.10
- 
Field SummaryFields inherited from class org.eclipse.swt.widgets.ControlhandleFields inherited from class org.eclipse.swt.widgets.WidgetnativeZoomFields inherited from interface org.eclipse.graphiti.ui.editor.IDiagramContainerUIDIAGRAM_CONTEXT_ID
- 
Constructor SummaryConstructorsConstructorDescriptionDiagramComposite(org.eclipse.swt.widgets.Composite parent, int style) DiagramComposite(org.eclipse.ui.IWorkbenchPart ownedPart, org.eclipse.swt.widgets.Composite parent, int style) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidclose()Notify the container that it should shut down or clear it's state.voidCalled to configure the graphical viewer before it receives its contents.protected DiagramBehaviorprotected voidCreates the GraphicalViewer on the specifiedComposite.protected final org.eclipse.gef.ui.palette.PaletteViewerProvidervoidvoiddispose()voiddoSave(org.eclipse.core.runtime.IProgressMonitor monitor) Triggers that the diagram model is persisted.voidvoidgetAdapter(Class type) Returns the adapter for the specified key.Returns theDiagramBehaviorinstance associated with this container.Returns theIDiagramEditorInputinstance used for this container.Gets the diagram type provider.org.eclipse.gef.GraphicalEditPartprotected final org.eclipse.gef.ui.palette.FlyoutPaletteComposite.FlyoutPreferencesprotected final org.eclipse.gef.palette.PaletteRootfinal DefaultRefreshBehaviorGets all pictogram elements that are currently selected.org.eclipse.ui.IWorkbenchPartSitegetSite()Returns theIWorkbenchPartSiteof the EclipseIWorkbenchPartthat displays this container.getTitle()Gets the title for the container that is displaying the diagram.Returns the tooltip for the container.final DefaultUpdateBehaviororg.eclipse.ui.IWorkbenchPartReturns the instance of the EclipseIWorkbenchPartthat displays this container.doublevoidOverride to set the contents of the GraphicalViewer after it has been created.booleanisAlive()booleanbooleanisDirty()Returnstrueif the command stack is dirtyvoidRefreshes the title text of this container.voidRefreshes the title tool tip text of this part.voidselectPictogramElements(PictogramElement[] pictogramElements) Selects all the given pictogram elements in the container.voidsetDirectEditingActive(boolean directEditingActive) booleansetFocus()Sets the focus by delegating to the super class implementation in the GEF editor and additionally triggers a update of the diagram by delegating toDefaultUpdateBehavior.handleActivate().voidsetInput(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain, IDiagramEditorInput input) voidsetInput(IDiagramEditorInput input) voidsetPictogramElementForSelection(PictogramElement pictogramElement) Sets the pictogram element which should be selected after the container refresh.voidsetPictogramElementsForSelection(PictogramElement[] pictogramElements) Sets the pictogram elements which should be selected after the container refresh.voidUpdates the UI of the container to correctly reflect the dirty state.Methods inherited from class org.eclipse.graphiti.ui.editor.GraphicalCompositecommandStackChanged, createActions, createControl, firePropertyChange, getActionRegistry, getCommandStack, getEditDomain, getGraphicalViewer, getPropertyActions, getSelectionActions, getSelectionSynchronizer, getStackActions, hookGraphicalViewer, init, initializeActionRegistry, selectionChanged, setActionRegistry, setEditDomain, setGraphicalViewer, stackChanged, updateActionsMethods inherited from class org.eclipse.swt.widgets.Compositechanged, 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.ScrollablecomputeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar, setScrollbarsModeMethods inherited from class org.eclipse.swt.widgets.ControladdControlListener, 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.WidgetaddDisposeListener, 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.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.swt.graphics.DrawableisAutoScalableMethods inherited from interface org.eclipse.graphiti.ui.editor.IDiagramContainerUIcommandStackChanged, getActionRegistry, getEditDomain, getGraphicalViewer, getSelectionActions, hookGraphicalViewer, setEditDomain, setGraphicalViewer
- 
Constructor Details- 
DiagramCompositepublic DiagramComposite(org.eclipse.ui.IWorkbenchPart ownedPart, org.eclipse.swt.widgets.Composite parent, int style) 
- 
DiagramCompositepublic DiagramComposite(org.eclipse.swt.widgets.Composite parent, int style) 
 
- 
- 
Method Details- 
createDiagramBehavior
- 
setInput
- 
setInputpublic void setInput(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain, IDiagramEditorInput input) 
- 
initializeGraphicalViewerpublic void initializeGraphicalViewer()Description copied from class:GraphicalCompositeOverride to set the contents of the GraphicalViewer after it has been created.- Specified by:
- initializeGraphicalViewerin interface- IDiagramContainerUI
- Overrides:
- initializeGraphicalViewerin class- GraphicalComposite
- See Also:
- 
- #createGraphicalViewer(Composite)
 
 
- 
createGraphicalViewerprotected void createGraphicalViewer()Description copied from class:GraphicalCompositeCreates the GraphicalViewer on the specifiedComposite.- Overrides:
- createGraphicalViewerin class- GraphicalComposite
 
- 
configureGraphicalViewerpublic void configureGraphicalViewer()Description copied from class:GraphicalCompositeCalled 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.- Specified by:
- configureGraphicalViewerin interface- IDiagramContainerUI
- Overrides:
- configureGraphicalViewerin class- GraphicalComposite
- Since:
- 0.12
 
- 
refreshTitlepublic void refreshTitle()Description copied from interface:IDiagramContainerRefreshes the title text of this container. It depends on the container type what and if anything is refreshed, for an editor e.g. the part tab will be refreshed.- Specified by:
- refreshTitlein interface- IDiagramContainer
 
- 
refreshTitleToolTippublic void refreshTitleToolTip()Description copied from interface:IDiagramContainerRefreshes the title tool tip text of this part. It depends on the container type what and if anything is refreshed, for an editor e.g. the part tab tooltip will be refreshed.- Specified by:
- refreshTitleToolTipin interface- IDiagramContainer
 
- 
updateDirtyStatepublic void updateDirtyState()Description copied from interface:IDiagramContainerUpdates the UI of the container to correctly reflect the dirty state. What (and if anything) happens depends on the container type. The default implementation in the editor e.g. does this by firing aIEditorPart#PROP_DIRTYproperty change.- Specified by:
- updateDirtyStatein interface- IDiagramContainer
 
- 
getWorkbenchPartpublic org.eclipse.ui.IWorkbenchPart getWorkbenchPart()Description copied from interface:IDiagramContainerUIReturns the instance of the EclipseIWorkbenchPartthat displays this container. E.g. for an editor this will be the editor itself.- Specified by:
- getWorkbenchPartin interface- IDiagramContainerUI
- Specified by:
- getWorkbenchPartin class- GraphicalComposite
- Returns:
- The IWorkbenchPartthat is displaying the diagram.
 
- 
closepublic void close()Description copied from interface:IDiagramContainerNotify the container that it should shut down or clear it's state.- Specified by:
- closein interface- IDiagramContainer
 
- 
getAdapterDescription copied from class:GraphicalCompositeReturns 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.- Specified by:
- getAdapterin interface- org.eclipse.core.runtime.IAdaptable
- Overrides:
- getAdapterin class- GraphicalComposite
- See Also:
- 
- IAdaptable.getAdapter(java.lang.Class)
 
 
- 
disposepublic void dispose()- Overrides:
- disposein class- GraphicalComposite
- See Also:
- 
- IWorkbenchPart.dispose()
 
 
- 
setFocuspublic boolean setFocus()Sets the focus by delegating to the super class implementation in the GEF editor and additionally triggers a update of the diagram by delegating toDefaultUpdateBehavior.handleActivate().- Overrides:
- setFocusin class- GraphicalComposite
 
- 
getUpdateBehavior
- 
getRefreshBehavior
- 
editingDomainInitializedpublic void editingDomainInitialized()
- 
disableAdapterspublic void disableAdapters()
- 
enableAdapterspublic void enableAdapters()
- 
isDirtypublic boolean isDirty()Description copied from class:GraphicalCompositeReturnstrueif the command stack is dirty- Specified by:
- isDirtyin interface- IDiagramContainer
- Overrides:
- isDirtyin class- GraphicalComposite
- Returns:
- true, if container is dirty,- falseotherwise
- See Also:
- 
- ISaveablePart.isDirty()
 
 
- 
createPaletteViewerProviderprotected final org.eclipse.gef.ui.palette.PaletteViewerProvider createPaletteViewerProvider()
- 
getPalettePreferencesprotected final org.eclipse.gef.ui.palette.FlyoutPaletteComposite.FlyoutPreferences getPalettePreferences()
- 
getPaletteRootprotected final org.eclipse.gef.palette.PaletteRoot getPaletteRoot()
- 
getSelectedPictogramElementsDescription copied from interface:IDiagramContainerGets all pictogram elements that are currently selected.- Specified by:
- getSelectedPictogramElementsin interface- IDiagramContainer
- Returns:
- all selected pictogram elements
 
- 
selectPictogramElementsDescription copied from interface:IDiagramContainerSelects all the given pictogram elements in the container.- Specified by:
- selectPictogramElementsin interface- IDiagramContainer
- Parameters:
- pictogramElements- The pictogram elements to select
 
- 
setPictogramElementForSelectionDescription copied from interface:IDiagramContainerSets the pictogram element which should be selected after the container refresh.- Specified by:
- setPictogramElementForSelectionin interface- IDiagramContainer
- Parameters:
- pictogramElement- The pictogram element to select
 
- 
setPictogramElementsForSelectionDescription copied from interface:IDiagramContainerSets the pictogram elements which should be selected after the container refresh.- Specified by:
- setPictogramElementsForSelectionin interface- IDiagramContainer
- Parameters:
- pictogramElements- The pictogram elements to select
 
- 
getDiagramTypeProviderDescription copied from interface:IDiagramContainerGets the diagram type provider.- Specified by:
- getDiagramTypeProviderin interface- IDiagramContainer
- Returns:
- The diagram type provider
 
- 
getEditPartForPictogramElement
- 
getZoomLevelpublic double getZoomLevel()
- 
isAlivepublic boolean isAlive()
- 
isDirectEditingActivepublic boolean isDirectEditingActive()
- 
setDirectEditingActivepublic void setDirectEditingActive(boolean directEditingActive) 
- 
getDiagramEditorInputDescription copied from interface:IDiagramContainerUIReturns theIDiagramEditorInputinstance used for this container. Basically it is used as an EclipseIEditorInputobject only in case the container is an editor; for other types of containers the input is simply used as a holder for a URI pointing to a diagram.- Specified by:
- getDiagramEditorInputin interface- IDiagramContainerUI
- Returns:
- The input containing the URI for the diagram
 
- 
getSitepublic org.eclipse.ui.IWorkbenchPartSite getSite()Description copied from interface:IDiagramContainerUIReturns theIWorkbenchPartSiteof the EclipseIWorkbenchPartthat displays this container. E.g. for an editor this will be the editor site.- Specified by:
- getSitein interface- IDiagramContainerUI
- Returns:
- The site for the IWorkbenchPartthat is displaying the diagram.
 
- 
getTitleDescription copied from interface:IDiagramContainerGets the title for the container that is displaying the diagram.- Specified by:
- getTitlein interface- IDiagramContainer
- Returns:
- The title as a String
 
- 
getTitleToolTipDescription copied from interface:IDiagramContainerReturns the tooltip for the container. For an editor that would e.g. be the string that is displayed when hovering over the editor title tab.- Specified by:
- getTitleToolTipin interface- IDiagramContainer
- Returns:
- The tooltip as a String
 
- 
doSavepublic void doSave(org.eclipse.core.runtime.IProgressMonitor monitor) Description copied from interface:IDiagramContainerTriggers that the diagram model is persisted.- Specified by:
- doSavein interface- IDiagramContainer
 
- 
getDiagramBehaviorDescription copied from interface:IDiagramContainerUIReturns theDiagramBehaviorinstance associated with this container.- Specified by:
- getDiagramBehaviorin interface- IDiagramContainer
- Specified by:
- getDiagramBehaviorin interface- IDiagramContainerUI
- Returns:
- The associated DiagramBehaviorinstance
 
 
-