Home » Modeling » EMF » Resource URL oddity
Resource URL oddity [message #495317] Wed, 04 November 2009 09:54 Go to next message
Thomas Hallgren  is currently offline Thomas Hallgren
Messages: 1450
Registered: July 2009
Senior Member
Hi,
I have two ecore models, each live in its own project and the first has references to the second. I have both projects
in my workspace. I also have an older version of the plugins that both projects represent installed in my IDE. They are
however not present in my target platform.

The references from my first ecore model to the second starts with "platform:/plugin/..." and my problem seems related
to how this URL is resolved. When I open the model using the reflective ecore model editor, it loads a resource
representing the latest version of the second my model (the one in my workspace). So far so good.

Now I open the corresponding ecorediag file with the Ecore Diagram Editor (the ecorediag file has the exact same
"platform/:plugin..." references). For some reason this editor loads the resource from the plugin installed in my IDE. I
haven't been able to figure out why. Loading from the target platform could be OK if the versions were equal (I can
understand how that could become an ambiguity), but from the IDE? That's just plain wrong, isn't it?

What kind of behavior should I expect here and how can I make sure that the correct model is loaded at all times?

Regards,
Thomas Hallgren
Re: Resource URL oddity [message #495365 is a reply to message #495317 ] Wed, 04 November 2009 11:10 Go to previous messageGo to next message
Ed Merks  is currently offline Ed Merks
Messages: 15894
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------010801080008090207060300
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Thomas,

Comments below.

Thomas Hallgren wrote:
> Hi,
> I have two ecore models, each live in its own project and the first
> has references to the second. I have both projects in my workspace. I
> also have an older version of the plugins that both projects represent
> installed in my IDE. They are however not present in my target platform.
EMF doesn't yet support references into the target platform.
>
> The references from my first ecore model to the second starts with
> "platform:/plugin/..."
So when you created the model, you referenced the Ecore in the installed
IDE...
> and my problem seems related to how this URL is resolved. When I open
> the model using the reflective ecore model editor,
The Sample Ecore Editor?
> it loads a resource representing the latest version of the second my
> model (the one in my workspace). So far so good.
Yes, it does redirects in the platform:/plugin case to find the version
if the workspace when it's present.
>
> Now I open the corresponding ecorediag file with the Ecore Diagram
> Editor (the ecorediag file has the exact same "platform/:plugin..."
> references). For some reason this editor loads the resource from the
> plugin installed in my IDE. I haven't been able to figure out why.
It probably doesn't have the little bit of magic that's in the Sample
Ecore Editor.

public void createModel()
{

*editingDomain.getResourceSet().getURIConverter().getURIMap( ).putAll(EcorePlugin.computePlatformURIMap());*

> Loading from the target platform could be OK if the versions were
> equal (I can understand how that could become an ambiguity), but from
> the IDE? That's just plain wrong, isn't it?
Less than ideal. :-P

There's a bugzilla open to support things in the target platform, but
the resource to make that work seems never to be available.
>
> What kind of behavior should I expect here and how can I make sure
> that the correct model is loaded at all times?
Better to reference the platform:/resource version then. In that case,
references will be relative, i.e., ../../<project>/model/Whatever.ecore
>
> Regards,
> Thomas Hallgren
>

--------------010801080008090207060300
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Thomas,<br>
<br>
Comments below.<br>
<br>
Thomas Hallgren wrote:
<blockquote cite="mid:hcs4ib$hr0$1.build.eclipse.org" type="cite">Hi,
<br>
I have two ecore models, each live in its own project and the first has
references to the second. I have both projects in my workspace. I also
have an older version of the plugins that both projects represent
installed in my IDE. They are however not present in my target
platform.
<br>
</blockquote>
EMF doesn't yet support references into the target platform.<br>
<blockquote cite="mid:hcs4ib$hr0$1.build.eclipse.org" type="cite"><br>
The references from my first ecore model to the second starts with
"platform:/plugin/..." </blockquote>
So when you created the model, you referenced the Ecore in the
installed IDE...<br>
<blockquote cite="mid:hcs4ib$hr0$1.build.eclipse.org" type="cite">and
my problem seems related to how this URL is resolved. When I open the
model using the reflective ecore model editor,</blockquote>
The Sample Ecore Editor?<br>
<blockquote cite="mid:hcs4ib$hr0$1.build.eclipse.org" type="cite"> it
loads a resource representing the latest version of the second my model
(the one in my workspace). So far so good.
<br>
</blockquote>
Yes, it does redirects in the platform:/plugin case to find the version
if the workspace when it's present.<br>
<blockquote cite="mid:hcs4ib$hr0$1.build.eclipse.org" type="cite"><br>
Now I open the corresponding ecorediag file with the Ecore Diagram
Editor (the ecorediag file has the exact same "platform/:plugin..."
references). For some reason this editor loads the resource from the
plugin installed in my IDE. I haven't been able to figure out why. </blockquote>
It probably doesn't have the little bit of magic that's in the Sample
Ecore Editor.<br>
<br>
&nbsp; public void createModel()<br>
&nbsp; {<br>
&nbsp;&nbsp;&nbsp; <b> editingDomain.getResourceSet().getURIConverter().getURIMap() .putAll(EcorePlugin.computePlatformURIMap()); </b><br>
<br>
<blockquote cite="mid:hcs4ib$hr0$1.build.eclipse.org" type="cite">Loading
from the target platform could be OK if the versions were equal (I can
understand how that could become an ambiguity), but from the IDE?
That's just plain wrong, isn't it?
<br>
</blockquote>
Less than ideal. :-P <br>
<br>
There's a bugzilla open to support things in the target platform, but
the resource to make that work seems never to be available.<br>
<blockquote cite="mid:hcs4ib$hr0$1.build.eclipse.org" type="cite"><br>
What kind of behavior should I expect here and how can I make sure that
the correct model is loaded at all times?
<br>
</blockquote>
Better to reference the platform:/resource version then.&nbsp; In that case,
references will be relative, i.e.,
.../../&lt;project&gt;/model/Whatever.ecore&nbsp ; <br>
<blockquote cite="mid:hcs4ib$hr0$1.build.eclipse.org" type="cite"><br>
Regards,
<br>
Thomas Hallgren
<br>
<br>
</blockquote>
</body>
</html>

--------------010801080008090207060300--
Re: Resource URL oddity [message #495374 is a reply to message #495365 ] Wed, 04 November 2009 11:26 Go to previous messageGo to next message
Thomas Hallgren  is currently offline Thomas Hallgren
Messages: 1450
Registered: July 2009
Senior Member
On 11/04/2009 05:10 PM, Ed Merks wrote:
>> Now I open the corresponding ecorediag file with the Ecore Diagram
>> Editor (the ecorediag file has the exact same "platform/:plugin..."
>> references). For some reason this editor loads the resource from the
>> plugin installed in my IDE. I haven't been able to figure out why.
> It probably doesn't have the little bit of magic that's in the Sample
> Ecore Editor.
>
> public void createModel()
> {
> *editingDomain.getResourceSet().getURIConverter().getURIMap( ).putAll(EcorePlugin.computePlatformURIMap());*
>
Aha. So should I enter a bugzilla for this on the Ecore Diagram Editor?

>> What kind of behavior should I expect here and how can I make sure
>> that the correct model is loaded at all times?
> Better to reference the platform:/resource version then. In that case,
> references will be relative, i.e., ../../<project>/model/Whatever.ecore

That will work in the workspace, but it probably breaks when I try accessing the model in a binary right? Or will the
.../../bundle/model resolve using binary bundles as well?

Regards,
Thomas Hallgren
Re: Resource URL oddity [message #495379 is a reply to message #495374 ] Wed, 04 November 2009 11:44 Go to previous messageGo to next message
Ed Merks  is currently offline Ed Merks
Messages: 15894
Registered: July 2009
Senior Member
Thomas,

Comments below.

Thomas Hallgren wrote:
> On 11/04/2009 05:10 PM, Ed Merks wrote:
>>> Now I open the corresponding ecorediag file with the Ecore Diagram
>>> Editor (the ecorediag file has the exact same "platform/:plugin..."
>>> references). For some reason this editor loads the resource from the
>>> plugin installed in my IDE. I haven't been able to figure out why.
>> It probably doesn't have the little bit of magic that's in the Sample
>> Ecore Editor.
>>
>> public void createModel()
>> {
>> *editingDomain.getResourceSet().getURIConverter().getURIMap( ).putAll(EcorePlugin.computePlatformURIMap());*
>>
>>
> Aha. So should I enter a bugzilla for this on the Ecore Diagram Editor?
Yes, they should behave consistently in this regard.
>
>>> What kind of behavior should I expect here and how can I make sure
>>> that the correct model is loaded at all times?
>> Better to reference the platform:/resource version then. In that case,
>> references will be relative, i.e., ../../<project>/model/Whatever.ecore
>
> That will work in the workspace, but it probably breaks when I try
> accessing the model in a binary right?
No because it's magical.
> Or will the ../../bundle/model resolve using binary bundles as well?
Yes.
>
> Regards,
> Thomas Hallgren
>
>
Re: Resource URL oddity [message #495522 is a reply to message #495379 ] Thu, 05 November 2009 03:22 Go to previous message
Thomas Hallgren  is currently offline Thomas Hallgren
Messages: 1450
Registered: July 2009
Senior Member
On 11/04/2009 05:44 PM, Ed Merks wrote:
>> Aha. So should I enter a bugzilla for this on the Ecore Diagram Editor?
> Yes, they should behave consistently in this regard.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=294287

- thomas
Previous Topic:[CDO] Integration with generated editors
Next Topic:How to figure out all attributes and associations of any model class
Goto Forum: