de.tu_berlin.cs.tfs.muvitorkit.ui
Class IDUtil

java.lang.Object
  extended by de.tu_berlin.cs.tfs.muvitorkit.ui.IDUtil

public final class IDUtil
extends Object

This purely static utility class encapsulates and manages the access to EObject models via their unique IDs (assigned by their XMLResource) and keeps track of the MuvitorTreeEditors showing those models. It is used properly by MuvitorTreeEditors and should not be needed elsewhere, except for getIDForModel(EObject) and possibly getRealURIFragment(EObject).

Rating red

Constructor Summary
IDUtil()
           
 
Method Summary
static MuvitorTreeEditor getHostEditor(EObject model)
          Method for getting the editor that hosts an EObject model (or rather its root container).
static String getIDForModel(EObject model)
          Convenience method for retrieving the unique ID this model has in its XMLResource.
static EObject getModelForID(String id)
          This method resolves an ID to an EObject model searching the models of all running MuvitorTreeEditors.
static String getRealURIFragment(EObject model)
          Convenience method the get the real URI fragment for an EObject model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IDUtil

public IDUtil()
Method Detail

getIDForModel

public static final String getIDForModel(EObject model)
Convenience method for retrieving the unique ID this model has in its XMLResource.

Parameters:
model - The model to get an ID for
Returns:
The unique EObject ID for the model
See Also:
getModelForID(String)

getRealURIFragment

public static final String getRealURIFragment(EObject model)
Convenience method the get the real URI fragment for an EObject model. Because we set XMLResource to use unique IDs for its models (see EMFModelManager) it will return these IDs if asked for the URIFragment. To get the real URIFragment we have to set the ID to null temporarily, which does this method.

Parameters:
model - the model element to get the URI fragment from
Returns:
the real URI fragment of the model rather than its ID

getModelForID

public static final EObject getModelForID(String id)
This method resolves an ID to an EObject model searching the models of all running MuvitorTreeEditors.

Parameters:
id - an ID that has been retrieved before
Returns:
the EObject that has the id

getHostEditor

public static final MuvitorTreeEditor getHostEditor(EObject model)
Method for getting the editor that hosts an EObject model (or rather its root container).

Parameters:
model - the model to find the hosting editor for
Returns:
the editor whose model root is the root container of the passed model