Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » dynamic pathmap:// variable registration & opening, editing, creating models with pathmap URIs
dynamic pathmap:// variable registration & opening, editing, creating models with pathmap URIs [message #619685] Tue, 05 June 2007 17:54
Nicolas Rouquette is currently offline Nicolas RouquetteFriend
Messages: 135
Registered: July 2009
Senior Member
The GMF pathmap mechanism is great for UML profiles; I recently found a
way to dynamically register pathmap variables but I seem to be missing
some additional registration to use UML profiles according to to
dynamically-registered pathmap variables.

To dynamically register a pathmap variable, I came up with the following
approach:

import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.emf.core.internal.resources.PathmapM anager;
....

private static String SHADDOCK_PROFILES = "SHADDOCK_PROFILES";
private static String SHADDOCK_PROFILE_RESOURCES = "/Planete/Shaddock";

....
if (!PathmapManager.isRegisteredPathVariable(SHADDOCK_PROFILES) ) {
IWorkspaceRoot wksroot = ResourcesPlugin.getWorkspace().getRoot();
IResource profiles = wksroot.findMember(SHADDOCK_PROFILE_RESOURCES);
String location = profiles.getLocationURI().toString();
PathmapManager.setPathVariable(SHADDOCK_PROFILES, location);
}

// Now that the pathmap variable is registered,
// the shaddocks can begin pumping and pumping...
....


The kosher approach would instead use a plugin to register a pathmap
variable and profiles on the org.eclipse.gmf.runtime.emf.core.Pathmaps
extension point. However, this approach is fastedious because it
requires launching a new Eclipse runtime environment.

Since the shaddocks are an impatient bunch of people, I'm trying to be
responsive to their angst with dynamic scripting to register pathmap
variables and, hopefully, open, edit, create UML models using
dynamically-registered pathmap variables and profiles as if I had
launched a runtime Eclipse environment.

The criteria of success is that a SHADDOCK-profiled UML model should
always refer to the SHADDOCK profile using pathmap URIs and nothing
else, especially not file- or jar-based URIs. A SHADDOCK-profiled model
should therefore look like this:

<xmi:XMI
...
xmlns:shaddock="http:///schemas/shaddock/.."
xsi:schemaLocation="... http:///schemas/shaddock/..
pathmap://SHADDOCK_PROFILES/.. ..."
...>
<uml:Model ...>
<packageImport .../>
<packagedElement ...>
...
</packagedElement>
<profileApplication xmi:id="..">
<eAnnotations
xmi:id="..."
source="http://www.eclipse.org/uml2/2.0.0/UML">
<references
xmi:type="ecore:EPackage"
href="pathmap://SHADDOCK_PROFILES/..."/>
</eAnnotations>
</profileApplication>
...
</uml:Model>
...
</xmi:XMI>

My solution seems incomplete and the shaddocks are unhappy.
Is there a kind soul who might have some words of wisdom to share
with me to solve this issue?

Cheers,
-- Nicolas.
Previous Topic:[Announce] MDT UML2 2.1.0 2.1RC2 is available
Next Topic:Re: proxy resolution problem
Goto Forum:
  


Current Time: Wed Nov 26 17:43:55 GMT 2014

Powered by FUDForum. Page generated in 0.01686 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software