Package de.cau.cs.kieler.klighd.ui.parts
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 ClassesModifier and TypeClassDescriptionstatic classActionBarContributor 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_INPUTFields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE -
Constructor Summary
ConstructorsModifierConstructorDescriptionCreates a diagram editor part.
Besides, anIResourceChangeListenerwill be installed on the workspace, which is in charge updating the diagram if the related editor input is changed.protectedDiagramEditorPart(boolean installResourceChangeListener) Creates a diagram editor part. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.eclipse.elk.graph.properties.IPropertyHolderReturns a configuration for the KLighD view.protected voidconfigureResourceSet(org.eclipse.emf.ecore.resource.ResourceSet set) Configures the given resource set.voidcreatePartControl(org.eclipse.swt.widgets.Composite parent) voiddispose()voiddoSave(org.eclipse.core.runtime.IProgressMonitor monitor) voiddoSaveAs()getAdapter(Class type) protected ZoomStyleorg.eclipse.elk.core.LayoutConfiguratorprotected ObjectgetModel()Getter, provides access to the input model to subclasses.voidinit(org.eclipse.ui.IEditorSite site, org.eclipse.ui.IEditorInput input) booleanisDirty()booleanprotected ObjectLoad a model from the editor input.protected static org.eclipse.emf.ecore.EObjectloadModel(org.eclipse.ui.IEditorInput input) Load a model from the editor input.protected booleanrequiresInitialLayout(ViewContext viewContext) Tester that decides on the need for computing the diagram layout while opening the diagram.
May be overridden by subclasses.voidvoidresetLayoutConfig(boolean doLayout) voidsetDirty(boolean dirty) voidsetFocus()protected voidSetter, 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, setPartNameMethods 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, showBusyMethods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObjectMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.ui.IEditorPart
getEditorInput, getEditorSiteMethods inherited from interface org.eclipse.ui.ISaveablePart
isSaveOnCloseNeededMethods inherited from interface org.eclipse.ui.IWorkbenchPart
addPropertyListener, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener
-
Constructor Details
-
DiagramEditorPart
public DiagramEditorPart()Creates a diagram editor part.
Besides, anIResourceChangeListenerwill 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- iftrueanIResourceChangeListenerwill 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:
initin interfaceorg.eclipse.ui.IEditorPart- Specified by:
initin classorg.eclipse.ui.part.EditorPart- Throws:
org.eclipse.ui.PartInitException
-
createPartControl
public void createPartControl(org.eclipse.swt.widgets.Composite parent) - Specified by:
createPartControlin interfaceorg.eclipse.ui.IWorkbenchPart- Specified by:
createPartControlin classorg.eclipse.ui.part.WorkbenchPart
-
requiresInitialLayout
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
- Returns:
- the
ZoomStylebeing applied during initial layout application.
-
getLayoutConfig
public org.eclipse.elk.core.LayoutConfigurator getLayoutConfig()- Specified by:
getLayoutConfigin interfaceILayoutConfigProvider
-
resetLayoutConfig
public void resetLayoutConfig()- Specified by:
resetLayoutConfigin interfaceILayoutConfigProvider
-
resetLayoutConfig
public void resetLayoutConfig(boolean doLayout) - Specified by:
resetLayoutConfigin interfaceILayoutConfigProvider
-
dispose
public void dispose()- Specified by:
disposein interfaceorg.eclipse.ui.IWorkbenchPart- Overrides:
disposein classorg.eclipse.ui.part.WorkbenchPart
-
getAdapter
- Specified by:
getAdapterin interfaceorg.eclipse.core.runtime.IAdaptable- Overrides:
getAdapterin classorg.eclipse.ui.part.WorkbenchPart
-
getPartId
- Specified by:
getPartIdin interfaceIDiagramWorkbenchPart
-
getViewer
- Specified by:
getViewerin interfaceIDiagramWorkbenchPart
-
getViewContext
- Specified by:
getViewContextin interfaceIDiagramWorkbenchPart
-
setFocus
public void setFocus()- Specified by:
setFocusin interfaceorg.eclipse.ui.IWorkbenchPart- Specified by:
setFocusin classorg.eclipse.ui.part.WorkbenchPart
-
isDirty
public boolean isDirty()- Specified by:
isDirtyin interfaceorg.eclipse.ui.ISaveablePart- Specified by:
isDirtyin classorg.eclipse.ui.part.EditorPart
-
setDirty
public void setDirty(boolean dirty) - Specified by:
setDirtyin interfaceIDiagramWorkbenchPart.IDiagramEditorPart
-
doSave
public void doSave(org.eclipse.core.runtime.IProgressMonitor monitor) - Specified by:
doSavein interfaceorg.eclipse.ui.ISaveablePart- Specified by:
doSavein classorg.eclipse.ui.part.EditorPart
-
isSaveAsAllowed
public boolean isSaveAsAllowed()- Specified by:
isSaveAsAllowedin interfaceorg.eclipse.ui.ISaveablePart- Specified by:
isSaveAsAllowedin classorg.eclipse.ui.part.EditorPart
-
doSaveAs
public void doSaveAs()- Specified by:
doSaveAsin interfaceorg.eclipse.ui.ISaveablePart- Specified by:
doSaveAsin classorg.eclipse.ui.part.EditorPart
-
loadModel
Load a model from the editor input. The result is put intomodel.- 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 intomodel.- Returns:
- the loaded model for convenience
- Throws:
org.eclipse.ui.PartInitException- if loading the model fails
-
getModel
Getter, provides access to the input model to subclasses.- Returns:
- the model
-
setModel
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.
-