Skip to main content


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 #473097] Tue, 05 June 2007 17:54 Go to next message
Nicolas Rouquette is currently offline Nicolas RouquetteFriend
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.
Re: dynamic pathmap:// variable registration & opening, editing, creating models with pathmap UR [message #473098 is a reply to message #473097] Tue, 05 June 2007 20:13 Go to previous messageGo to next message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Nicolas,

Is this what you are looking for ?

URIConverter.URI_MAP.put(URI.createURI(UMLResource.LIBRARIES _PATHMAP),
umlResourcePlugingURI.appendSegment("libraries").appendSegment( ""));

Have a look at the uml migration guide (toward the bottom) for the complete
example of registering pathmaps in a stand-alone application.

Regards,

- James.


"Nicolas Rouquette" <nicolas.rouquette@jpl.nasa.gov> wrote in message
news:f4480e$lno$1@build.eclipse.org...
> 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.
Re: dynamic pathmap:// variable registration & opening, editing, creating models with pathmap UR [message #473119 is a reply to message #473098] Thu, 07 June 2007 18:19 Go to previous messageGo to next message
Nicolas Rouquette is currently offline Nicolas RouquetteFriend
Messages: 157
Registered: July 2009
Senior Member
Hi James,

Thanks for the suggestion; however, the pathmap problem here may be a
bit different. Here's the scenario:

1) in Eclipse environment #1, I have a Shaddock plugin that registers a
pathmap variable + UML profiles.

In RSA, this might be result in URIs like this:
pathmap://SHADDOCK_PROFILES/Shaddoc.epx

Now, there are two ways to use the <<Shaddock>> UML profile:

2a) From #1, start #2, a new runtime environment w/ the Shaddock plugin.
I can use the pathmap-registered UML profile to create
<<Shaddock>>-profiled UML models.

Been there, done that... The problem is that it's a drag to launch/quit
the second runtime environment everytime I need to use a change to the
<<Shaddock>> profile. In France, the Shaddocks are known to be a bunch
of people busy running their pumps to jump off their miserable planet
for greener pastures on their neighbor planet.

This shaddock here is pumping out profile changes on a daily basis;
hence the need for a better solution.

2b) Within #1, dynamically register the <<Shaddock>> UML profile
as a pathmap-based resource, i.e., as
pathmap://SHADDOCK_PROFILES/Shaddock.epx in RSA.

Why? so that the Shaddock pumps that work in (2a) will also work in (2b)
and vice-versa.

As I mentioned before, I know how to use the GMF internal Pathmap class
API to register a pathmap variable but when I create a new UML model,
Eclipse (or RSA) behaves as if there were no registered <<Shaddock>>
profile. Clearly, I must be missing a registration but this seems to be
a different kind of registration than that of the URIConverter API.

-- Nicolas.

James Bruck wrote:
> Hi Nicolas,
>
> Is this what you are looking for ?
>
> URIConverter.URI_MAP.put(URI.createURI(UMLResource.LIBRARIES _PATHMAP),
> umlResourcePlugingURI.appendSegment("libraries").appendSegment( ""));
>
> Have a look at the uml migration guide (toward the bottom) for the complete
> example of registering pathmaps in a stand-alone application.
>
> Regards,
>
> - James.
>
>
> "Nicolas Rouquette" <nicolas.rouquette@jpl.nasa.gov> wrote in message
> news:f4480e$lno$1@build.eclipse.org...
>> 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.
>
>
Re: dynamic pathmap:// variable registration & opening, editing, creating models with pathmap UR [message #473129 is a reply to message #473119] Fri, 08 June 2007 19:40 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Nicolas,

As far as I know, GMF manages a map of URIConverters on a per resource basis
and also uses a path map manager for managing the kinds of things you ar
looking for.

You might get what you want by using a GMF resource set and use GMF path map
manager ( which is an adapter ).

Try posting a question to the GMF newsgroup for a more coherent answer :)
Or have a look at IPathmapManager.


Cheers,

- James.


"Nicolas Rouquette" <nicolas.rouquette@jpl.nasa.gov> wrote in message
news:f49i6s$v99$1@build.eclipse.org...
> Hi James,
>
> Thanks for the suggestion; however, the pathmap problem here may be a
> bit different. Here's the scenario:
>
> 1) in Eclipse environment #1, I have a Shaddock plugin that registers a
> pathmap variable + UML profiles.
>
> In RSA, this might be result in URIs like this:
> pathmap://SHADDOCK_PROFILES/Shaddoc.epx
>
> Now, there are two ways to use the <<Shaddock>> UML profile:
>
> 2a) From #1, start #2, a new runtime environment w/ the Shaddock plugin.
> I can use the pathmap-registered UML profile to create
> <<Shaddock>>-profiled UML models.
>
> Been there, done that... The problem is that it's a drag to launch/quit
> the second runtime environment everytime I need to use a change to the
> <<Shaddock>> profile. In France, the Shaddocks are known to be a bunch
> of people busy running their pumps to jump off their miserable planet
> for greener pastures on their neighbor planet.
>
> This shaddock here is pumping out profile changes on a daily basis;
> hence the need for a better solution.
>
> 2b) Within #1, dynamically register the <<Shaddock>> UML profile
> as a pathmap-based resource, i.e., as
> pathmap://SHADDOCK_PROFILES/Shaddock.epx in RSA.
>
> Why? so that the Shaddock pumps that work in (2a) will also work in (2b)
> and vice-versa.
>
> As I mentioned before, I know how to use the GMF internal Pathmap class
> API to register a pathmap variable but when I create a new UML model,
> Eclipse (or RSA) behaves as if there were no registered <<Shaddock>>
> profile. Clearly, I must be missing a registration but this seems to be
> a different kind of registration than that of the URIConverter API.
>
> -- Nicolas.
>
> James Bruck wrote:
> > Hi Nicolas,
> >
> > Is this what you are looking for ?
> >
> > URIConverter.URI_MAP.put(URI.createURI(UMLResource.LIBRARIES _PATHMAP),
> > umlResourcePlugingURI.appendSegment("libraries").appendSegment( ""));
> >
> > Have a look at the uml migration guide (toward the bottom) for the
complete
> > example of registering pathmaps in a stand-alone application.
> >
> > Regards,
> >
> > - James.
> >
> >
> > "Nicolas Rouquette" <nicolas.rouquette@jpl.nasa.gov> wrote in message
> > news:f4480e$lno$1@build.eclipse.org...
> >> 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.
> >
> >
Re: dynamic pathmap:// variable registration & opening, editing, creating models with pathmap UR [message #619746 is a reply to message #473097] Tue, 05 June 2007 20:13 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Nicolas,

Is this what you are looking for ?

URIConverter.URI_MAP.put(URI.createURI(UMLResource.LIBRARIES _PATHMAP),
umlResourcePlugingURI.appendSegment("libraries").appendSegment( ""));

Have a look at the uml migration guide (toward the bottom) for the complete
example of registering pathmaps in a stand-alone application.

Regards,

- James.


"Nicolas Rouquette" <nicolas.rouquette@jpl.nasa.gov> wrote in message
news:f4480e$lno$1@build.eclipse.org...
> 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.
Re: dynamic pathmap:// variable registration & opening, editing, creating models with pathmap UR [message #619902 is a reply to message #473098] Thu, 07 June 2007 18:19 Go to previous message
Nicolas Rouquette is currently offline Nicolas RouquetteFriend
Messages: 157
Registered: July 2009
Senior Member
Hi James,

Thanks for the suggestion; however, the pathmap problem here may be a
bit different. Here's the scenario:

1) in Eclipse environment #1, I have a Shaddock plugin that registers a
pathmap variable + UML profiles.

In RSA, this might be result in URIs like this:
pathmap://SHADDOCK_PROFILES/Shaddoc.epx

Now, there are two ways to use the <<Shaddock>> UML profile:

2a) From #1, start #2, a new runtime environment w/ the Shaddock plugin.
I can use the pathmap-registered UML profile to create
<<Shaddock>>-profiled UML models.

Been there, done that... The problem is that it's a drag to launch/quit
the second runtime environment everytime I need to use a change to the
<<Shaddock>> profile. In France, the Shaddocks are known to be a bunch
of people busy running their pumps to jump off their miserable planet
for greener pastures on their neighbor planet.

This shaddock here is pumping out profile changes on a daily basis;
hence the need for a better solution.

2b) Within #1, dynamically register the <<Shaddock>> UML profile
as a pathmap-based resource, i.e., as
pathmap://SHADDOCK_PROFILES/Shaddock.epx in RSA.

Why? so that the Shaddock pumps that work in (2a) will also work in (2b)
and vice-versa.

As I mentioned before, I know how to use the GMF internal Pathmap class
API to register a pathmap variable but when I create a new UML model,
Eclipse (or RSA) behaves as if there were no registered <<Shaddock>>
profile. Clearly, I must be missing a registration but this seems to be
a different kind of registration than that of the URIConverter API.

-- Nicolas.

James Bruck wrote:
> Hi Nicolas,
>
> Is this what you are looking for ?
>
> URIConverter.URI_MAP.put(URI.createURI(UMLResource.LIBRARIES _PATHMAP),
> umlResourcePlugingURI.appendSegment("libraries").appendSegment( ""));
>
> Have a look at the uml migration guide (toward the bottom) for the complete
> example of registering pathmaps in a stand-alone application.
>
> Regards,
>
> - James.
>
>
> "Nicolas Rouquette" <nicolas.rouquette@jpl.nasa.gov> wrote in message
> news:f4480e$lno$1@build.eclipse.org...
>> 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.
>
>
Re: dynamic pathmap:// variable registration & opening, editing, creating models with pathmap UR [message #619917 is a reply to message #473119] Fri, 08 June 2007 19:40 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Nicolas,

As far as I know, GMF manages a map of URIConverters on a per resource basis
and also uses a path map manager for managing the kinds of things you ar
looking for.

You might get what you want by using a GMF resource set and use GMF path map
manager ( which is an adapter ).

Try posting a question to the GMF newsgroup for a more coherent answer :)
Or have a look at IPathmapManager.


Cheers,

- James.


"Nicolas Rouquette" <nicolas.rouquette@jpl.nasa.gov> wrote in message
news:f49i6s$v99$1@build.eclipse.org...
> Hi James,
>
> Thanks for the suggestion; however, the pathmap problem here may be a
> bit different. Here's the scenario:
>
> 1) in Eclipse environment #1, I have a Shaddock plugin that registers a
> pathmap variable + UML profiles.
>
> In RSA, this might be result in URIs like this:
> pathmap://SHADDOCK_PROFILES/Shaddoc.epx
>
> Now, there are two ways to use the <<Shaddock>> UML profile:
>
> 2a) From #1, start #2, a new runtime environment w/ the Shaddock plugin.
> I can use the pathmap-registered UML profile to create
> <<Shaddock>>-profiled UML models.
>
> Been there, done that... The problem is that it's a drag to launch/quit
> the second runtime environment everytime I need to use a change to the
> <<Shaddock>> profile. In France, the Shaddocks are known to be a bunch
> of people busy running their pumps to jump off their miserable planet
> for greener pastures on their neighbor planet.
>
> This shaddock here is pumping out profile changes on a daily basis;
> hence the need for a better solution.
>
> 2b) Within #1, dynamically register the <<Shaddock>> UML profile
> as a pathmap-based resource, i.e., as
> pathmap://SHADDOCK_PROFILES/Shaddock.epx in RSA.
>
> Why? so that the Shaddock pumps that work in (2a) will also work in (2b)
> and vice-versa.
>
> As I mentioned before, I know how to use the GMF internal Pathmap class
> API to register a pathmap variable but when I create a new UML model,
> Eclipse (or RSA) behaves as if there were no registered <<Shaddock>>
> profile. Clearly, I must be missing a registration but this seems to be
> a different kind of registration than that of the URIConverter API.
>
> -- Nicolas.
>
> James Bruck wrote:
> > Hi Nicolas,
> >
> > Is this what you are looking for ?
> >
> > URIConverter.URI_MAP.put(URI.createURI(UMLResource.LIBRARIES _PATHMAP),
> > umlResourcePlugingURI.appendSegment("libraries").appendSegment( ""));
> >
> > Have a look at the uml migration guide (toward the bottom) for the
complete
> > example of registering pathmaps in a stand-alone application.
> >
> > Regards,
> >
> > - James.
> >
> >
> > "Nicolas Rouquette" <nicolas.rouquette@jpl.nasa.gov> wrote in message
> > news:f4480e$lno$1@build.eclipse.org...
> >> 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:Exporting UML diagram and profile
Next Topic:derived tagged value in a stereotype.
Goto Forum:
  


Current Time: Thu Mar 28 13:36:11 GMT 2024

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

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

Back to the top