Package de.cau.cs.kieler.klighd.ui.parts
Class DiagramViewPart
java.lang.Object
org.eclipse.core.commands.common.EventManager
org.eclipse.ui.part.WorkbenchPart
org.eclipse.ui.part.ViewPart
de.cau.cs.kieler.klighd.ui.parts.DiagramViewPart
- All Implemented Interfaces:
IDiagramWorkbenchPart,ILayoutConfigProvider,org.eclipse.core.runtime.IAdaptable,org.eclipse.core.runtime.IExecutableExtension,org.eclipse.ui.IPersistable,org.eclipse.ui.IViewPart,org.eclipse.ui.IWorkbenchPart,org.eclipse.ui.IWorkbenchPart2,org.eclipse.ui.IWorkbenchPart3,org.eclipse.ui.part.IWorkbenchPartOrientation
public class DiagramViewPart
extends org.eclipse.ui.part.ViewPart
implements IDiagramWorkbenchPart, ILayoutConfigProvider
A view which is able to display models in lightweight diagrams.
This class may well be subclassed to use it as a base for custom viewers. In that case, you will want to
override createPartControl(Composite) and therein call createDiagramViewer(Composite) to
create the diagram viewer.
- Author:
- mri, chsch, msp, uru
-
Nested Class Summary
Nested classes/interfaces inherited from interface de.cau.cs.kieler.klighd.IDiagramWorkbenchPart
IDiagramWorkbenchPart.IDiagramEditorPart -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringAction identifier for resetting the layout options in the side bar.static final Stringthe default name for this view.static final StringThe id thisViewPartis registered with in the extension point.Fields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAdd the buttons to the tool bar.protected KlighdSynthesisPropertiesReturns a configuration for the KLighD view.protected org.eclipse.swt.widgets.CompositecreateDiagramViewer(org.eclipse.swt.widgets.Composite parent) Creates the context viewer and the composite it is placed in and sets up everything properly.voidcreatePartControl(org.eclipse.swt.widgets.Composite parent) voiddispose()protected voidfillViewMenu(org.eclipse.jface.action.IMenuManager menuManager) Fill the view menu with some contributions.org.eclipse.jface.action.IActionRetrieve an action with the specified identifier.org.eclipse.elk.core.LayoutConfiguratorvoidinitialize(Object model, String name, org.eclipse.elk.graph.properties.IPropertyHolder properties) (Re-)Initializes the givenDiagramViewPart.
This involves the creation of aViewContext, the execution the matching implementationAbstractDiagramSynthesis, the application of automatic layout.booleanReturns true if thisViewPartis disposed.protected Objectprotected voidRegisters the default print support, may be overriden if necessary.voidvoidresetLayoutConfig(boolean doLayout) voidsetFocus()voidSets a new name for the view.voidupdateOptions(boolean fitSpace) (Re-)Evaluates the diagram (synthesis) and layout options registered in the employedViewContextand populates the diagram side bar accordingly.Methods inherited from class org.eclipse.ui.part.ViewPart
checkSite, getViewSite, init, init, saveState, setContentDescription, setInitializationData, setPartNameMethods inherited from class org.eclipse.ui.part.WorkbenchPart
addPartPropertyListener, addPropertyListener, firePartPropertyChanged, firePropertyChange, getAdapter, getConfigurationElement, getContentDescription, getDefaultImage, getOrientation, getPartName, getPartProperties, getPartProperty, getSite, getTitle, getTitleImage, getTitleToolTip, 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.core.runtime.IAdaptable
getAdapterMethods inherited from interface org.eclipse.ui.IWorkbenchPart
addPropertyListener, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener
-
Field Details
-
VIEW_ID
The id thisViewPartis registered with in the extension point.- See Also:
-
ACTION_ID_RESET_LAYOUT_OPTIONS
Action identifier for resetting the layout options in the side bar.- See Also:
-
DEFAULT_NAME
the default name for this view.- See Also:
-
-
Constructor Details
-
DiagramViewPart
public DiagramViewPart()
-
-
Method Details
-
createPartControl
public void createPartControl(org.eclipse.swt.widgets.Composite parent) CallscreateDiagramViewer(Composite). If this method is overridden, feel free to call that method yourself instead of calling this implementation.- Specified by:
createPartControlin interfaceorg.eclipse.ui.IWorkbenchPart- Specified by:
createPartControlin classorg.eclipse.ui.part.WorkbenchPart
-
createDiagramViewer
protected org.eclipse.swt.widgets.Composite createDiagramViewer(org.eclipse.swt.widgets.Composite parent) Creates the context viewer and the composite it is placed in and sets up everything properly. You may want to pass a parent composite that will only contain the diagram composite. This is because the diagram sidebar will use that same composite to place the sidebar in.- Parameters:
parent- the control the composite should be placed in.- Returns:
- the composite that holds the context viewer.
-
initialize
public void initialize(Object model, String name, org.eclipse.elk.graph.properties.IPropertyHolder properties) (Re-)Initializes the givenDiagramViewPart.
This involves the creation of aViewContext, the execution the matching implementationAbstractDiagramSynthesis, the application of automatic layout. and the update of the diagram side bar entries.- Parameters:
name- the name (can be null if the view should be created with the default name)model- the model (can be null if the view should be created without an initial model)properties- the property holder containing properties configurations ornull
-
getViewContext
- Specified by:
getViewContextin interfaceIDiagramWorkbenchPart
-
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
-
updateOptions
public void updateOptions(boolean fitSpace) (Re-)Evaluates the diagram (synthesis) and layout options registered in the employedViewContextand populates the diagram side bar accordingly. For internal use only!- Parameters:
fitSpace- iftrueaZoomStyle#ZOOM_TO_FITwill applied to the diagram in order to fit into the remaining space
-
isDisposed
public boolean isDisposed()Returns true if thisViewPartis disposed. Since theDiagramViewManagertracks created views it needs to test whether those views are still alive.- Returns:
- whether
dispose()has been called on thisViewPart
-
fillViewMenu
protected void fillViewMenu(org.eclipse.jface.action.IMenuManager menuManager) Fill the view menu with some contributions.- Parameters:
menuManager- the menu manager
-
addButtons
protected void addButtons()Add the buttons to the tool bar. -
loadModel
-
configureKlighdProperties
Returns a configuration for the KLighD view. Override this method to use a custom configuration.- Returns:
- KLighD configuration or
null. - See Also:
-
registerPrintSupport
protected void registerPrintSupport()Registers the default print support, may be overriden if necessary. -
setFocus
public void setFocus()- Specified by:
setFocusin interfaceorg.eclipse.ui.IWorkbenchPart- Specified by:
setFocusin classorg.eclipse.ui.part.WorkbenchPart
-
getPartId
- Specified by:
getPartIdin interfaceIDiagramWorkbenchPart
-
getViewer
- Specified by:
getViewerin interfaceIDiagramWorkbenchPart
-
getAction
Retrieve an action with the specified identifier.- Parameters:
id- an action identifier- Returns:
- the corresponding action
-
setName
Sets a new name for the view.- Parameters:
name- the name
-