Package de.cau.cs.kieler.klighd.ui
Class DiagramViewManager
java.lang.Object
de.cau.cs.kieler.klighd.ui.DiagramViewManager
- All Implemented Interfaces:
org.eclipse.ui.IPartListener
A singleton manager for creating, updating and closing diagram views. All methods in this class
have to be called in the UI thread.
- Author:
- mri, chsch
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanCloses the diagram view associated with the given id.static DiagramViewPartcreateView(String id, String name, Object model) Creates aDiagramViewPartshowing the desired diagram ofmodel.static DiagramViewPartcreateView(String id, String name, Object model, org.eclipse.elk.graph.properties.IPropertyHolder properties) Creates aDiagramViewPartshowing the desired diagram ofmodel.static IDiagramWorkbenchPartReturns theIDiagramWorkbenchPartassociated with the given identifier if available.static DiagramEditorPartReturns the diagram editor part with the given identifier if available.static DiagramViewManagerReturns the singleton instance.static DiagramViewPartReturns the diagram view with the given identifier if available.static DiagramViewPartinitializeView(DiagramViewPart diagramView, Object model, String name, org.eclipse.elk.graph.properties.IPropertyHolder properties) Deprecated.voidpartActivated(org.eclipse.ui.IWorkbenchPart part) voidpartBroughtToTop(org.eclipse.ui.IWorkbenchPart part) voidpartClosed(org.eclipse.ui.IWorkbenchPart part) voidpartDeactivated(org.eclipse.ui.IWorkbenchPart part) voidpartOpened(org.eclipse.ui.IWorkbenchPart part) voidAllowsIDiagramWorkbenchParts that are not created via this manager to be registered, e.g.voidIs package protected in order to be callable fromDiagramViewPart.dispose().static IDiagramWorkbenchPartupdateView(ViewContext viewContext) Updates the diagram view corresponding to the givenViewContext.
TheviewContext's current input model is taken as new input.static IDiagramWorkbenchPartupdateView(ViewContext viewContext, Object model) Updates the diagram view corresponding to the givenViewContext.
The model has to be of the type of the old model, i.e.static IDiagramWorkbenchPartupdateView(String id) Updates the diagram view with the given identifier.
The model has to be of the type of the old model, i.e.static IDiagramWorkbenchPartupdateView(String id, String name, Object model, org.eclipse.elk.graph.properties.IPropertyHolder properties) Updates the diagram view with the given identifier with a specified name and model.
The model has to be of the type of the old model, i.e.static IDiagramWorkbenchPartupdateView(String id, org.eclipse.elk.graph.properties.IPropertyHolder properties) Updates the diagram view with the given identifier.
The model has to be of the type of the old model, i.e.
-
Method Details
-
getInstance
Returns the singleton instance.- Returns:
- the singleton instance
-
getDiagramWorkbenchPart
Returns theIDiagramWorkbenchPartassociated with the given identifier if available.- Parameters:
id- the diagram view identifier (can be null for the default view)- Returns:
- the diagram view or null if no view with the given identifier exists
-
getView
Returns the diagram view with the given identifier if available.- Parameters:
id- the diagram view identifier (can be null for the default view)- Returns:
- the diagram view or null if no view with the given identifier exists
-
getEditor
Returns the diagram editor part with the given identifier if available.- Parameters:
id- the diagram view identifier (can be null for the default view)- Returns:
- the diagram editor part or null if no view with the given identifier exists
-
updateView
Updates the diagram view with the given identifier.
The model has to be of the type of the old model, i.e. the view context associated with the identifier must support the model.- Parameters:
id- the diagram identifier (can be null for the default view)- Returns:
- the view with the identifier or null on failure
-
updateView
public static IDiagramWorkbenchPart updateView(String id, org.eclipse.elk.graph.properties.IPropertyHolder properties) Updates the diagram view with the given identifier.
The model has to be of the type of the old model, i.e. the view context associated with the identifier must support the model.- Parameters:
id- the diagram identifier (can be null for the default view)properties- the property holder containing properties configurations ornull- Returns:
- the view with the identifier or null on failure
-
updateView
public static IDiagramWorkbenchPart updateView(String id, String name, Object model, org.eclipse.elk.graph.properties.IPropertyHolder properties) Updates the diagram view with the given identifier with a specified name and model.
The model has to be of the type of the old model, i.e. the view context associated with the identifier must support the model.- Parameters:
id- the diagram identifier (can be null for the default view)name- the name (can be null if the name of the view should remain unchanged)model- the model (can be null if the displayed model should remain unchanged)properties- the property holder containing properties configurations ornull- Returns:
- the view with the identifier or null on failure
-
updateView
Updates the diagram view corresponding to the givenViewContext.
TheviewContext's current input model is taken as new input.- Parameters:
viewContext- theViewContextof the diagram to be updated- Returns:
- the view with the identifier or null on failure
-
updateView
Updates the diagram view corresponding to the givenViewContext.
The model has to be of the type of the old model, i.e. the view context associated with the identifier must support the model.- Parameters:
viewContext- theViewContextof the diagram to be updatedmodel- the new model, ifnullthe current input model is taken- Returns:
- the view with the identifier or null on failure
-
createView
Creates aDiagramViewPartshowing the desired diagram ofmodel. The diagram view will exhibit the given name and can be addressed via the specified id.- Parameters:
id- the diagram identifier (can benullfor the default view)name- the name, may benullif the view should be created with the default namemodel- the model, may benullif the view should be created without an initial model- Returns:
- the view with the identifier (newly created or reused if it exists already), or
nullon failure
-
createView
public static DiagramViewPart createView(String id, String name, Object model, org.eclipse.elk.graph.properties.IPropertyHolder properties) Creates aDiagramViewPartshowing the desired diagram ofmodel. The diagram view will exhibit the given name and can be addressed via the specified id.- Parameters:
id- the diagram identifier (can benullfor the default view)name- the name, may benullif the view should be created with the default namemodel- the model, may benullif the view should be created without an initial modelproperties- the property holder containing properties configurations ornull- Returns:
- the view with the identifier (newly created or reused if it exists already), or
nullon failure
-
initializeView
public static DiagramViewPart initializeView(DiagramViewPart diagramView, Object model, String name, org.eclipse.elk.graph.properties.IPropertyHolder properties) Deprecated.(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:
diagramView- theDiagramViewPart, must not benullname- 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- Returns:
diagramViewfor convenience
-
registerView
AllowsIDiagramWorkbenchParts that are not created via this manager to be registered, e.g.DiagramEditorParts. This is (currently) necessary in order to let the side bar work correctly (diagram refresh), since those event listener callupdateView(String, IPropertyHolder).- Parameters:
part- theIDiagramWorkbenchPartto register
-
unregisterView
Is package protected in order to be callable fromDiagramViewPart.dispose().- Parameters:
part- the part being closed
-
closeView
Closes the diagram view associated with the given id.- Parameters:
id- the identifier of the view to be closed.- Returns:
trueif a view could be closed successfully, andfalseotherwise.
-
partClosed
public void partClosed(org.eclipse.ui.IWorkbenchPart part) - Specified by:
partClosedin interfaceorg.eclipse.ui.IPartListener
-
partOpened
public void partOpened(org.eclipse.ui.IWorkbenchPart part) - Specified by:
partOpenedin interfaceorg.eclipse.ui.IPartListener
-
partActivated
public void partActivated(org.eclipse.ui.IWorkbenchPart part) - Specified by:
partActivatedin interfaceorg.eclipse.ui.IPartListener
-
partDeactivated
public void partDeactivated(org.eclipse.ui.IWorkbenchPart part) - Specified by:
partDeactivatedin interfaceorg.eclipse.ui.IPartListener
-
partBroughtToTop
public void partBroughtToTop(org.eclipse.ui.IWorkbenchPart part) - Specified by:
partBroughtToTopin interfaceorg.eclipse.ui.IPartListener
-
DiagramViewPart.initialize(Object, String, IPropertyHolder)