de.cau.cs.kieler.core.model.graphiti
Class GraphitiFrameworkBridge

java.lang.Object
  extended by de.cau.cs.kieler.core.model.graphiti.GraphitiFrameworkBridge
All Implemented Interfaces:
IGraphicalFrameworkBridge

public class GraphitiFrameworkBridge
extends Object
implements IGraphicalFrameworkBridge

Editing provider for Graphiti.

Rating red

Constructor Summary
GraphitiFrameworkBridge()
           
 
Method Summary
 IFigure getDrawingLayer(EditPart editPart)
          Returns a layer figure for the associated diagram that can be used to draw additional information.
 EditingDomain getEditingDomain(Object object)
          Retrieve the editing domain for model changes of the given object.
 EditPart getEditPart(IWorkbenchPart workbenchPart, Object object)
          Returns the relevant edit part for the given object.
 EditPart getEditPart(Object object)
          Returns the relevant edit part for the given object.
static org.eclipse.graphiti.ui.internal.parts.IPictogramElementEditPart getEditPartFromDiagramEditorInternal2(EditPart editPart)
          In some cases the EditPart passed to the methods is the mysterious DiagramEditorInternal$2.
 EObject getElement(Object object)
          Retrieve the domain model element from the given object.
 EObject getNotationElement(Object object)
          Retrieve the notational model element from the given object.
 ISelection getSelection(IWorkbenchPart workbenchPart)
          Returns the current selection for the given editor part.
 ZoomManager getZoomManager(EditPart editPart)
          Returns a zoom manager for the associated diagram.
 boolean supports(Object object)
          Determine whether this bridge supports the given object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphitiFrameworkBridge

public GraphitiFrameworkBridge()
Method Detail

supports

public boolean supports(Object object)
Determine whether this bridge supports the given object.

Specified by:
supports in interface IGraphicalFrameworkBridge
Parameters:
object - an edit part, editor part, or notational object
Returns:
true if this bridge supports the given object

getElement

public EObject getElement(Object object)
Retrieve the domain model element from the given object.

Specified by:
getElement in interface IGraphicalFrameworkBridge
Parameters:
object - a selectable object, such as an edit part
Returns:
the domain model element, or null if there is none

getNotationElement

public EObject getNotationElement(Object object)
Retrieve the notational model element from the given object. The kind of notational element depends on the specific graphical framework.

Specified by:
getNotationElement in interface IGraphicalFrameworkBridge
Parameters:
object - a selectable object, such as an edit part
Returns:
the notational model element, or null if there is none

getEditPart

public EditPart getEditPart(Object object)
Returns the relevant edit part for the given object. If a diagram editor part is passed, then the return value is the corresponding diagram edit part. If an edit part is passed, it is filtered in such a way that the most relevant related edit part is returned; e.g. for a compartment edit part the containing node edit part is returned. If a model element is passed, the most relevant edit part in the active editor is returned.

Specified by:
getEditPart in interface IGraphicalFrameworkBridge
Parameters:
object - an editor part, edit part, notational object, or model element
Returns:
the relevant edit part, or null if the passed object cannot be handled

getEditPart

public EditPart getEditPart(IWorkbenchPart workbenchPart,
                            Object object)
Returns the relevant edit part for the given object. If a model element is passed, the most relevant edit part in the given editor is returned.

Specified by:
getEditPart in interface IGraphicalFrameworkBridge
Parameters:
workbenchPart - a workbench part containing a diagram
object - an edit part, notational object, or model element
Returns:
the relevant edit part, or null if the passed object cannot be handled

getEditingDomain

public EditingDomain getEditingDomain(Object object)
Retrieve the editing domain for model changes of the given object.

Specified by:
getEditingDomain in interface IGraphicalFrameworkBridge
Parameters:
object - a selectable object, such as an edit part
Returns:
the transactional editing domain, or null if there is none

getEditPartFromDiagramEditorInternal2

public static org.eclipse.graphiti.ui.internal.parts.IPictogramElementEditPart getEditPartFromDiagramEditorInternal2(EditPart editPart)
In some cases the EditPart passed to the methods is the mysterious DiagramEditorInternal$2. This method tries to get the root edit part from the corresponding diagram.

Parameters:
editPart - the diagram's top-level edit part
Returns:
the root pictogram element edit part

getDrawingLayer

public IFigure getDrawingLayer(EditPart editPart)
Returns a layer figure for the associated diagram that can be used to draw additional information.

Specified by:
getDrawingLayer in interface IGraphicalFrameworkBridge
Parameters:
editPart - an edit part from a graphical diagram
Returns:
a drawing layer

getZoomManager

public ZoomManager getZoomManager(EditPart editPart)
Returns a zoom manager for the associated diagram.

Specified by:
getZoomManager in interface IGraphicalFrameworkBridge
Parameters:
editPart - an edit part from a graphical diagram
Returns:
a zoom manager

getSelection

public ISelection getSelection(IWorkbenchPart workbenchPart)
Returns the current selection for the given editor part.

Specified by:
getSelection in interface IGraphicalFrameworkBridge
Parameters:
workbenchPart - a workbench part containing a diagram
Returns:
the current selection, or null if the selection cannot be determined