Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Cross reference items not available in .chk files
Cross reference items not available in .chk files [message #46237] Fri, 29 May 2009 08:03 Go to next message
Eclipse UserFriend
Hi,

I'm trying to write checks (.chk file) for a model that contains cross
references to an another grammar/model. It looks like the cross references
are not available in the .chk file. No code completion for them and marked
as "unknown properties". For Example:

import myDslB;

context Attribute ERROR "Error" : type; // more to come here

Where "type" is a cross reference to another grammar and marked as an
error in the .chk editor. I also recognized a problem with the generated
ecore file. When opening it with the ecore editor and navigating to a
cross reference item, it gives

Problems encounterd in file "classpath:/org/xtext/example/MyDslA.ecore"
java.net.MalformedURLException: unknown protocol: classpath

Any ideas?

Christoph

P.S.: The grammars are:

grammar org.xtext.example.MyDslA with org.eclipse.xtext.common.Terminals

generate myDslA "http://www.xtext.org/example/MyDslA"

Model :
(imports+=Import)*
(datatypes+=DataType)*;

Import :
'import' importURI=STRING;

DataType:
'datatype' name=ID ';'?;

----

grammar org.xtext.example.MyDslB with org.eclipse.xtext.common.Terminals

import "classpath:/org/xtext/example/MyDslA.ecore" as MyDslA

generate myDslB "http://www.xtext.org/example/MyDslB"

Model :
(imports+=Import)*
(classes+=Class);

Import :
'import' importURI=STRING;

Class :
'class' name=ID '{'
properties+=Property*
'}';

Property:
Attribute | Reference;

Attribute:
'attr' name=ID ':' type=[MyDslA::DataType] ';'?;

Reference:
'ref' name=ID ':' type=[Class] ';'?;
Re: Cross reference items not available in .chk files [message #46325 is a reply to message #46237] Fri, 29 May 2009 08:18 Go to previous messageGo to next message
Eclipse UserFriend
Referencing ecore files using the classpath scheme is not good, since
resource sets need to be configured with a special URIConverter in order
to be able resolve classpath URIs.

EMF and so Xpand both do not support classpath URIs.

You should instead use a platform:/resource URI.

Cheers,
Sven


Christoph Kulla schrieb:
> Hi,
>
> I'm trying to write checks (.chk file) for a model that contains cross
> references to an another grammar/model. It looks like the cross
> references are not available in the .chk file. No code completion for
> them and marked as "unknown properties". For Example:
> import myDslB;
>
> context Attribute ERROR "Error" : type; // more to come here
>
> Where "type" is a cross reference to another grammar and marked as an
> error in the .chk editor. I also recognized a problem with the generated
> ecore file. When opening it with the ecore editor and navigating to a
> cross reference item, it gives
>
> Problems encounterd in file "classpath:/org/xtext/example/MyDslA.ecore"
> java.net.MalformedURLException: unknown protocol: classpath
>
> Any ideas?
> Christoph
>
> P.S.: The grammars are:
>
> grammar org.xtext.example.MyDslA with org.eclipse.xtext.common.Terminals
>
> generate myDslA "http://www.xtext.org/example/MyDslA"
>
> Model :
> (imports+=Import)*
> (datatypes+=DataType)*;
>
> Import :
> 'import' importURI=STRING;
>
> DataType:
> 'datatype' name=ID ';'?;
>
> ----
>
> grammar org.xtext.example.MyDslB with org.eclipse.xtext.common.Terminals
>
> import "classpath:/org/xtext/example/MyDslA.ecore" as MyDslA
>
> generate myDslB "http://www.xtext.org/example/MyDslB"
> Model :
> (imports+=Import)*
> (classes+=Class);
>
> Import :
> 'import' importURI=STRING;
>
> Class :
> 'class' name=ID '{'
> properties+=Property*
> '}';
>
> Property:
> Attribute | Reference;
>
> Attribute:
> 'attr' name=ID ':' type=[MyDslA::DataType] ';'?;
>
> Reference:
> 'ref' name=ID ':' type=[Class] ';'?;
>
>
>
Re: Cross reference items not available in .chk files [message #46385 is a reply to message #46325] Fri, 29 May 2009 08:46 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

thanks Sven. I just used the "classpath:/" scheme as the documentation
says this it is the preferred way. I think it would be good when the
documentation lists the several schemes with their pro and cons.

Christoph
Re: Cross reference items not available in .chk files [message #46480 is a reply to message #46385] Fri, 29 May 2009 16:33 Go to previous message
Eclipse UserFriend
Yes, we just recently (because of the bug you submitted) realized that
the classpath scheme has its problems.
We'll update the documentation ASAP.

Thanks,
Sven

Christoph Kulla schrieb:
> Hi,
>
> thanks Sven. I just used the "classpath:/" scheme as the documentation
> says this it is the preferred way. I think it would be good when the
> documentation lists the several schemes with their pro and cons.
>
> Christoph
Previous Topic:[XText] problem in importing a metamodel.
Next Topic:[AText] a question releated to removing left recursion.
Goto Forum:
  


Current Time: Tue Jun 24 09:21:43 EDT 2025

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

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

Back to the top