de.cau.cs.kieler.kvid
Class KvidUtil

java.lang.Object
  extended by de.cau.cs.kieler.kvid.KvidUtil

public final class KvidUtil
extends Object

Utility class for the KViD-Plugin. Holds commonly used methods statically.

Rating red

Method Summary
static String fragmentUri2PtolemyUri(String fragmentUri, Resource resource)
          Converts a EMF/GMF Fragment URI into a Ptolemy URI.
static IEditorPart getActiveEditor()
          Helper method for getting the currently active editor.
static List<List<Point>> getPathsByElement(KvidUri elementUri, org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor currentEditor, LayoutMapping<?> diagramLayout)
          Compute animation paths and location for a given model element (referred by an URI).
static String ptolemyUri2FragmentUri(String ptolemyUri, Resource resource)
          Converts a Ptolemy URI into a EMF/GMF Fragment URI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

fragmentUri2PtolemyUri

public static String fragmentUri2PtolemyUri(String fragmentUri,
                                            Resource resource)
Converts a EMF/GMF Fragment URI into a Ptolemy URI. A Fragment URI looks like: //(type).(number of child of this type)/ etc. A Ptolemy URI looks like: .(element name).(second element name) This requires unique names on the same hierarchy level.

Parameters:
fragmentUri - The Fragment URI to convert
resource - The resource which holds the model element referred by the Fragment URI
Returns:
A Ptolemy URI referring the model element

ptolemyUri2FragmentUri

public static String ptolemyUri2FragmentUri(String ptolemyUri,
                                            Resource resource)
Converts a Ptolemy URI into a EMF/GMF Fragment URI. A Fragment URI looks like: //(type).(number of child of this type)/ etc. A Ptolemy URI looks like: .(element name).(second element name) This requires unique names on the same hierarchy level.

Parameters:
ptolemyUri - A Ptolemy URI referring the model element
resource - The resource which holds the model element referred by the Fragment URI
Returns:
The Fragment URI

getPathsByElement

public static List<List<Point>> getPathsByElement(KvidUri elementUri,
                                                  org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor currentEditor,
                                                  LayoutMapping<?> diagramLayout)
Compute animation paths and location for a given model element (referred by an URI).

Parameters:
elementUri - The URI object referring the model element
currentEditor - The editor which holds the model element
diagramLayout - The layout of the diagram which contains the model element
Returns:
A list of paths, represented by a list of Points

getActiveEditor

public static IEditorPart getActiveEditor()
Helper method for getting the currently active editor.

Returns:
The currently active editor in the UI or null