dynamic pathmap:// variable registration & opening, editing, creating models with pathmap URIs [message #619685] |
Tue, 05 June 2007 17:54 |
Nicolas Rouquette Messages: 157 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.
|
|
|
Powered by
FUDForum. Page generated in 0.04344 seconds