Class DiagramEditorPart

java.lang.Object
org.eclipse.core.commands.common.EventManager
org.eclipse.ui.part.WorkbenchPart
org.eclipse.ui.part.EditorPart
de.cau.cs.kieler.klighd.ui.parts.DiagramEditorPart
All Implemented Interfaces:
IDiagramWorkbenchPart, IDiagramWorkbenchPart.IDiagramEditorPart, ILayoutConfigProvider, org.eclipse.core.runtime.IAdaptable, org.eclipse.core.runtime.IExecutableExtension, org.eclipse.ui.IEditorPart, org.eclipse.ui.ISaveablePart, org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.IWorkbenchPart2, org.eclipse.ui.IWorkbenchPart3, org.eclipse.ui.part.IWorkbenchPartOrientation

public class DiagramEditorPart extends org.eclipse.ui.part.EditorPart implements IDiagramWorkbenchPart.IDiagramEditorPart, ILayoutConfigProvider
An editor which is able to display models in lightweight diagrams.
Author:
msp, chsch, uru
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    ActionBarContributor providing the print action for DiagramEditorParts.

    Nested classes/interfaces inherited from interface de.cau.cs.kieler.klighd.IDiagramWorkbenchPart

    IDiagramWorkbenchPart.IDiagramEditorPart
  • Field Summary

    Fields inherited from interface org.eclipse.ui.IEditorPart

    PROP_DIRTY, PROP_INPUT

    Fields inherited from interface org.eclipse.ui.IWorkbenchPart

    PROP_TITLE
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
     
    Creates a diagram editor part.
    Besides, an IResourceChangeListener will be installed on the workspace, which is in charge updating the diagram if the related editor input is changed.
    protected
    DiagramEditorPart(boolean installResourceChangeListener)
    Creates a diagram editor part.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected org.eclipse.elk.graph.properties.IPropertyHolder
    Returns a configuration for the KLighD view.
    protected void
    configureResourceSet(org.eclipse.emf.ecore.resource.ResourceSet set)
    Configures the given resource set.
    void
    createPartControl(org.eclipse.swt.widgets.Composite parent)
    void
    void
    doSave(org.eclipse.core.runtime.IProgressMonitor monitor)
    void
    protected ZoomStyle
    Provides the initial ZoomStyle, which is NONE by default.
    org.eclipse.elk.core.LayoutConfigurator
    protected Object
    Getter, provides access to the input model to subclasses.
    void
    init(org.eclipse.ui.IEditorSite site, org.eclipse.ui.IEditorInput input)
    boolean
    boolean
    protected Object
    Load a model from the editor input.
    protected static org.eclipse.emf.ecore.EObject
    loadModel(org.eclipse.ui.IEditorInput input)
    Load a model from the editor input.
    protected boolean
    Tester that decides on the need for computing the diagram layout while opening the diagram.
    May be overridden by subclasses.
    void
    void
    resetLayoutConfig(boolean doLayout)
    void
    setDirty(boolean dirty)
    void
    protected void
    Setter, allows to change the input model in subclass implementations.

    Methods inherited from class org.eclipse.ui.part.EditorPart

    checkSite, getEditorInput, getEditorSite, getTitleToolTip, isSaveOnCloseNeeded, setContentDescription, setInitializationData, setInput, setInputWithNotify, setPartName

    Methods inherited from class org.eclipse.ui.part.WorkbenchPart

    addPartPropertyListener, addPropertyListener, firePartPropertyChanged, firePropertyChange, getConfigurationElement, getContentDescription, getDefaultImage, getOrientation, getPartName, getPartProperties, getPartProperty, getSite, getTitle, getTitleImage, removePartPropertyListener, removePropertyListener, setPartProperty, setSite, setTitle, setTitleImage, setTitleToolTip, showBusy

    Methods inherited from class org.eclipse.core.commands.common.EventManager

    addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.eclipse.ui.IEditorPart

    getEditorInput, getEditorSite

    Methods inherited from interface org.eclipse.ui.ISaveablePart

    isSaveOnCloseNeeded

    Methods inherited from interface org.eclipse.ui.IWorkbenchPart

    addPropertyListener, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener
  • Constructor Details

    • DiagramEditorPart

      public DiagramEditorPart()
      Creates a diagram editor part.
      Besides, an IResourceChangeListener will be installed on the workspace, which is in charge updating the diagram if the related editor input is changed.
    • DiagramEditorPart

      protected DiagramEditorPart(boolean installResourceChangeListener)
      Creates a diagram editor part.
      Parameters:
      installResourceChangeListener - if true an IResourceChangeListener will be installed on the workspace, which is in charge updating the diagram if the related editor input is changed.
  • Method Details

    • init

      public void init(org.eclipse.ui.IEditorSite site, org.eclipse.ui.IEditorInput input) throws org.eclipse.ui.PartInitException
      Specified by:
      init in interface org.eclipse.ui.IEditorPart
      Specified by:
      init in class org.eclipse.ui.part.EditorPart
      Throws:
      org.eclipse.ui.PartInitException
    • createPartControl

      public void createPartControl(org.eclipse.swt.widgets.Composite parent)
      Specified by:
      createPartControl in interface org.eclipse.ui.IWorkbenchPart
      Specified by:
      createPartControl in class org.eclipse.ui.part.WorkbenchPart
    • requiresInitialLayout

      protected boolean requiresInitialLayout(ViewContext viewContext)
      Tester that decides on the need for computing the diagram layout while opening the diagram.
      May be overridden by subclasses.
      Parameters:
      viewContext - provides context data that might be incorporated in the decision
      Returns:
      true if the layout shall be (re-) computed while opening the diagram.
    • getInitialZoomStyle

      protected ZoomStyle getInitialZoomStyle()
      Provides the initial ZoomStyle, which is NONE by default. May be overridden by sub classes.
      Returns:
      the ZoomStyle being applied during initial layout application.
    • getLayoutConfig

      public org.eclipse.elk.core.LayoutConfigurator getLayoutConfig()
      Specified by:
      getLayoutConfig in interface ILayoutConfigProvider
    • resetLayoutConfig

      public void resetLayoutConfig()
      Specified by:
      resetLayoutConfig in interface ILayoutConfigProvider
    • resetLayoutConfig

      public void resetLayoutConfig(boolean doLayout)
      Specified by:
      resetLayoutConfig in interface ILayoutConfigProvider
    • dispose

      public void dispose()
      Specified by:
      dispose in interface org.eclipse.ui.IWorkbenchPart
      Overrides:
      dispose in class org.eclipse.ui.part.WorkbenchPart
    • getAdapter

      public Object getAdapter(Class type)
      Specified by:
      getAdapter in interface org.eclipse.core.runtime.IAdaptable
      Overrides:
      getAdapter in class org.eclipse.ui.part.WorkbenchPart
    • getPartId

      public String getPartId()
      Specified by:
      getPartId in interface IDiagramWorkbenchPart
    • getViewer

      public IViewer getViewer()
      Specified by:
      getViewer in interface IDiagramWorkbenchPart
    • getViewContext

      public ViewContext getViewContext()
      Specified by:
      getViewContext in interface IDiagramWorkbenchPart
    • setFocus

      public void setFocus()
      Specified by:
      setFocus in interface org.eclipse.ui.IWorkbenchPart
      Specified by:
      setFocus in class org.eclipse.ui.part.WorkbenchPart
    • isDirty

      public boolean isDirty()
      Specified by:
      isDirty in interface org.eclipse.ui.ISaveablePart
      Specified by:
      isDirty in class org.eclipse.ui.part.EditorPart
    • setDirty

      public void setDirty(boolean dirty)
      Specified by:
      setDirty in interface IDiagramWorkbenchPart.IDiagramEditorPart
    • doSave

      public void doSave(org.eclipse.core.runtime.IProgressMonitor monitor)
      Specified by:
      doSave in interface org.eclipse.ui.ISaveablePart
      Specified by:
      doSave in class org.eclipse.ui.part.EditorPart
    • isSaveAsAllowed

      public boolean isSaveAsAllowed()
      Specified by:
      isSaveAsAllowed in interface org.eclipse.ui.ISaveablePart
      Specified by:
      isSaveAsAllowed in class org.eclipse.ui.part.EditorPart
    • doSaveAs

      public void doSaveAs()
      Specified by:
      doSaveAs in interface org.eclipse.ui.ISaveablePart
      Specified by:
      doSaveAs in class org.eclipse.ui.part.EditorPart
    • loadModel

      protected Object loadModel() throws org.eclipse.ui.PartInitException
      Load a model from the editor input. The result is put into model.
      Returns:
      the loaded model for convenience
      Throws:
      org.eclipse.ui.PartInitException - if loading the model fails
    • loadModel

      protected static org.eclipse.emf.ecore.EObject loadModel(org.eclipse.ui.IEditorInput input) throws org.eclipse.ui.PartInitException
      Load a model from the editor input. The result is put into model.
      Returns:
      the loaded model for convenience
      Throws:
      org.eclipse.ui.PartInitException - if loading the model fails
    • getModel

      protected Object getModel()
      Getter, provides access to the input model to subclasses.
      Returns:
      the model
    • setModel

      protected void setModel(Object model)
      Setter, allows to change the input model in subclass implementations.
      Parameters:
      model - the model to set
    • configureResourceSet

      protected void configureResourceSet(org.eclipse.emf.ecore.resource.ResourceSet set)
      Configures the given resource set. The default implementation does nothing.
      Parameters:
      set - the resource set to be configured.
    • configureKlighdProperties

      protected org.eclipse.elk.graph.properties.IPropertyHolder configureKlighdProperties()
      Returns a configuration for the KLighD view. Override this method to use a custom configuration. The default implementation configures KLighD to use the simple update strategy.
      Returns:
      KLighD configuration.