Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Packages should be imported by their namespace URI.
Packages should be imported by their namespace URI. [message #900370] Mon, 06 August 2012 17:08 Go to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6843
Registered: July 2009
Senior Member
Hi

Pending a response to https://bugs.eclipse.org/bugs/show_bug.cgi?id=366476;

How does an Xtext grammar distinguish between the following scenarios?

a) the imported *.ecore is a concurrent development and so the
platform:/resource rather than platform:/plugin variant should be used.

b) the imported *.ecore is a stable reference and so the
platform:/plugin or http:/... variant should be used.

In Xtext 2.1 it was possible to use

import "platform:/resource/..."

This is still possible in 2.3, but it causes unwanted warnings.

Regards

Ed Willink
Re: Packages should be imported by their namespace URI. [message #960233 is a reply to message #900370] Sat, 27 October 2012 09:38 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6843
Registered: July 2009
Senior Member
Hi

Ping. What is the warning-free way in which to import an Ecore model
into Xtext so that the Ecore model is resolved to the *.ecore file (or
Java classes) in an active workspace project rather than those in an
installed plugin?

Regards

Ed Willink


On 06/08/2012 19:08, Ed Willink wrote:
> Hi
>
> Pending a response to
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=366476;
>
> How does an Xtext grammar distinguish between the following scenarios?
>
> a) the imported *.ecore is a concurrent development and so the
> platform:/resource rather than platform:/plugin variant should be used.
>
> b) the imported *.ecore is a stable reference and so the
> platform:/plugin or http:/... variant should be used.
>
> In Xtext 2.1 it was possible to use
>
> import "platform:/resource/..."
>
> This is still possible in 2.3, but it causes unwanted warnings.
>
> Regards
>
> Ed Willink
>
Re: Packages should be imported by their namespace URI. [message #960499 is a reply to message #960233] Sat, 27 October 2012 14:44 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3108
Registered: July 2009
Senior Member
The EPackages are looked up in the index by their nsURI. Therefore you
should always use that one. Things from the workspace are preferred over
packages from the target platform which are in turn preferred over
installed packages from the workbench.

Hope that helps,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 27.10.12 11:38, schrieb Ed Willink:
> Hi
>
> Ping. What is the warning-free way in which to import an Ecore model
> into Xtext so that the Ecore model is resolved to the *.ecore file (or
> Java classes) in an active workspace project rather than those in an
> installed plugin?
>
> Regards
>
> Ed Willink
>
>
> On 06/08/2012 19:08, Ed Willink wrote:
>> Hi
>>
>> Pending a response to
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=366476;
>>
>> How does an Xtext grammar distinguish between the following scenarios?
>>
>> a) the imported *.ecore is a concurrent development and so the
>> platform:/resource rather than platform:/plugin variant should be used.
>>
>> b) the imported *.ecore is a stable reference and so the
>> platform:/plugin or http:/... variant should be used.
>>
>> In Xtext 2.1 it was possible to use
>>
>> import "platform:/resource/..."
>>
>> This is still possible in 2.3, but it causes unwanted warnings.
>>
>> Regards
>>
>> Ed Willink
>>
>
Re: Packages should be imported by their namespace URI. [message #960813 is a reply to message #960499] Sat, 27 October 2012 20:46 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6843
Registered: July 2009
Senior Member
Hi Sebastian

Ah! That index. That explains somethings, but

a) why do I have to use an index when in Xtext 2.0, I could specify what
I want explicitly? (no need to have index building wasting my CPU cycles
every time EGIT wakes up.)

b) why do I have to add the Xtext nature to my model plugins, just to be
able to reference them via an index?

c) it doesn't work when A.xtext references B.ecore, which references
C.ecore, each in different plugins because
- C.ecore must be imported by nsURI from A.xtext to suit Xtext indexing
- C.ecore must be referenced by relative path from B.ecore to suit Ecore
referencing
This causes Xtext to fail with an unhelpfully conflicting model element
diagnostic. So I still get warnings, though not quite as many as when
using import 'platform:/resource/...' in conventional EMF (and Xtext
2.0) style.

Regards

Ed Willink

On 27/10/2012 15:44, Sebastian Zarnekow wrote:
> The EPackages are looked up in the index by their nsURI. Therefore you
> should always use that one. Things from the workspace are preferred
> over packages from the target platform which are in turn preferred
> over installed packages from the workbench.
>
> Hope that helps,
> Sebastian
Re: Packages should be imported by their namespace URI. [message #961276 is a reply to message #960813] Sun, 28 October 2012 05:55 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 31473
Registered: July 2009
Senior Member
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Ed,<br>
<br>
Comments below.<br>
<br>
<div class="moz-cite-prefix">On 27/10/2012 10:46 PM, Ed Willink
wrote:<br>
</div>
<blockquote cite="mid:k6hh84$dm5$1@xxxxxxxxe.org" type="cite">Hi
Sebastian
<br>
<br>
Ah! That index. That explains somethings, but
<br>
<br>
a) why do I have to use an index when in Xtext 2.0, I could
specify what I want explicitly? (no need to have index building
wasting my CPU cycles every time EGIT wakes up.)
<br>
</blockquote>
Because the grammars themselves depend on the index for importing
other grammars.<br>
<blockquote cite="mid:k6hh84$dm5$1@xxxxxxxxe.org" type="cite">
<br>
b) why do I have to add the Xtext nature to my model plugins, just
to be able to reference them via an index?
<br>
</blockquote>
Because projects in the workspace are indexed only if they have an
Xtext nature to save those CPU cycles if you don't want your project
indexed.<br>
<blockquote cite="mid:k6hh84$dm5$1@xxxxxxxxe.org" type="cite">
<br>
c) it doesn't work when A.xtext references B.ecore, which
references C.ecore, each in different plugins because
<br>
- C.ecore must be imported by nsURI from A.xtext to suit Xtext
indexing
<br>
- C.ecore must be referenced by relative path from B.ecore to suit
Ecore referencing
<br>
</blockquote>
I'm hopeful that between fixing these two bugs (the first committed
yesterday and the second pending review of the Xtext team) this
problem will be fully addressed.<br>
<blockquote><a class="moz-txt-link-freetext" href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=220218">https://bugs.eclipse.org/bugs/show_bug.cgi?id=220218</a><br>
<a class="moz-txt-link-freetext" href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=390411">https://bugs.eclipse.org/bugs/show_bug.cgi?id=390411</a><br>
</blockquote>
<br>
<blockquote cite="mid:k6hh84$dm5$1@xxxxxxxxe.org" type="cite">This
causes Xtext to fail with an unhelpfully conflicting model element
diagnostic. So I still get warnings, though not quite as many as
when using import 'platform:/resource/...' in conventional EMF
(and Xtext 2.0) style.
<br>
</blockquote>
I'd suggest making a small example along with the steps to reproduce
them so we can make sure that this problem disappears with the above
two issues addressed.&nbsp; I imagine it should be the case that either
platform:/resource or nsURI should work properly (because with the
first bugzilla addressed, the EMF models for all target platform
bundles will be visible as platform:/resource/&lt;bundle-id&gt;,
even the ones that aren't really physically in the workspace)...<br>
<blockquote cite="mid:k6hh84$dm5$1@xxxxxxxxe.org" type="cite">
<br>
&nbsp;&nbsp;&nbsp; Regards
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Ed Willink
<br>
<br>
On 27/10/2012 15:44, Sebastian Zarnekow wrote:
<br>
<blockquote type="cite">The EPackages are looked up in the index
by their nsURI. Therefore you should always use that one. Things
from the workspace are preferred over packages from the target
platform which are in turn preferred over installed packages
from the workbench.
<br>
<br>
Hope that helps,
<br>
Sebastian
<br>
</blockquote>
<br>
</blockquote>
<br>
</body>
</html>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:How to execute two different types of resolution in same unit of work?
Next Topic:Could I create jdt projects in the workspace as result of a xtext generator ?
Goto Forum:
  


Current Time: Wed Sep 23 03:51:33 GMT 2020

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

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

Back to the top