Class DiagramComposite

  • All Implemented Interfaces:
    java.util.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

    public class DiagramComposite
    extends GraphicalComposite
    implements IDiagramContainerUI
    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
    • Constructor Detail

      • DiagramComposite

        public DiagramComposite​(org.eclipse.ui.IWorkbenchPart ownedPart,
                                org.eclipse.swt.widgets.Composite parent,
                                int style)
      • DiagramComposite

        public DiagramComposite​(org.eclipse.swt.widgets.Composite parent,
                                int style)
    • Method Detail

      • createDiagramBehavior

        protected DiagramBehavior createDiagramBehavior()
      • setInput

        public void setInput​(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain,
                             IDiagramEditorInput input)
      • refreshTitle

        public void refreshTitle()
        Description copied from interface: IDiagramContainer
        Refreshes 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:
        refreshTitle in interface IDiagramContainer
      • refreshTitleToolTip

        public void refreshTitleToolTip()
        Description copied from interface: IDiagramContainer
        Refreshes 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:
        refreshTitleToolTip in interface IDiagramContainer
      • updateDirtyState

        public void updateDirtyState()
        Description copied from interface: IDiagramContainer
        Updates 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 a IEditorPart#PROP_DIRTY property change.
        Specified by:
        updateDirtyState in interface IDiagramContainer
      • getWorkbenchPart

        public org.eclipse.ui.IWorkbenchPart getWorkbenchPart()
        Description copied from interface: IDiagramContainerUI
        Returns the instance of the Eclipse IWorkbenchPart that displays this container. E.g. for an editor this will be the editor itself.
        Specified by:
        getWorkbenchPart in interface IDiagramContainerUI
        Specified by:
        getWorkbenchPart in class GraphicalComposite
        Returns:
        The IWorkbenchPart that is displaying the diagram.
      • close

        public void close()
        Description copied from interface: IDiagramContainer
        Notify the container that it should shut down or clear it's state.
        Specified by:
        close in interface IDiagramContainer
      • getAdapter

        public java.lang.Object getAdapter​(java.lang.Class type)
        Description copied from class: GraphicalComposite
        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.

        Specified by:
        getAdapter in interface org.eclipse.core.runtime.IAdaptable
        Overrides:
        getAdapter in class GraphicalComposite
        See Also:
        IAdaptable.getAdapter(java.lang.Class)
      • editingDomainInitialized

        public void editingDomainInitialized()
      • disableAdapters

        public void disableAdapters()
      • enableAdapters

        public void enableAdapters()
      • createPaletteViewerProvider

        protected final org.eclipse.gef.ui.palette.PaletteViewerProvider createPaletteViewerProvider()
      • getPalettePreferences

        protected final org.eclipse.gef.ui.palette.FlyoutPaletteComposite.FlyoutPreferences getPalettePreferences()
      • getPaletteRoot

        protected final org.eclipse.gef.palette.PaletteRoot getPaletteRoot()
      • getEditPartForPictogramElement

        public org.eclipse.gef.GraphicalEditPart getEditPartForPictogramElement​(PictogramElement pe)
      • getZoomLevel

        public double getZoomLevel()
      • isAlive

        public boolean isAlive()
      • isDirectEditingActive

        public boolean isDirectEditingActive()
      • setDirectEditingActive

        public void setDirectEditingActive​(boolean directEditingActive)
      • getDiagramEditorInput

        public IDiagramEditorInput getDiagramEditorInput()
        Description copied from interface: IDiagramContainerUI
        Returns the IDiagramEditorInput instance used for this container. Basically it is used as an Eclipse IEditorInput object 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:
        getDiagramEditorInput in interface IDiagramContainerUI
        Returns:
        The input containing the URI for the diagram
      • getSite

        public org.eclipse.ui.IWorkbenchPartSite getSite()
        Description copied from interface: IDiagramContainerUI
        Returns the IWorkbenchPartSite of the Eclipse IWorkbenchPart that displays this container. E.g. for an editor this will be the editor site.
        Specified by:
        getSite in interface IDiagramContainerUI
        Returns:
        The site for the IWorkbenchPart that is displaying the diagram.
      • getTitle

        public java.lang.String getTitle()
        Description copied from interface: IDiagramContainer
        Gets the title for the container that is displaying the diagram.
        Specified by:
        getTitle in interface IDiagramContainer
        Returns:
        The title as a String
      • getTitleToolTip

        public java.lang.String getTitleToolTip()
        Description copied from interface: IDiagramContainer
        Returns 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:
        getTitleToolTip in interface IDiagramContainer
        Returns:
        The tooltip as a String
      • doSave

        public void doSave​(org.eclipse.core.runtime.IProgressMonitor monitor)
        Description copied from interface: IDiagramContainer
        Triggers that the diagram model is persisted.
        Specified by:
        doSave in interface IDiagramContainer