Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » cross referencing resource contents of another language
cross referencing resource contents of another language [message #843504] Fri, 13 April 2012 05:11 Go to next message
Kagan Turgut is currently offline Kagan TurgutFriend
Messages: 3
Registered: April 2012
Location: San Francisco
Junior Member

I have two "split" grammars created separately into their own projects. The grammars are summarized as follows:

Foo: extends XType
...
ComponentType:
'componentType' name = ID
('configuration' configuration = JvmTypeReference)?
;
;

Bar: extends XBase
...
import "..company.com/foo/Foo" as foo
...
Component:
{Component}
type=[foo::ComponentType|QualifiedName]
name=ValidID
;
...
;

I overrode default ImportUriGlobalScopeProvider as follows:

protected LinkedHashSet<URI> getImportedUris(Resource resource) {
LinkedHashSet<URI> temp = super.getImportedUris(resource); temp.add(URI.createURI("platform:/plugin/path/to/foo/file/cxf.foo"));
return temp;
}

When I have both .foo and .bar files in the same workspace, it is able to locate ComponentType as well as the Configuration of the ComponentType.
However, when the .foo file is in parent workspace, or deployed in dropins folder, then it can find the ComponentType but navigating to ComponentType.configuration results in JvmVoid as opposed to JvmGenericType.

I suspect this is happening since FooScopeProvider is not delegating to BarScopeProvider. I appreciate any feedback as I am debugging into how to best do this...
Best regards,
Kagan
Re: cross referencing resource contents of another language [message #845653 is a reply to message #843504] Sun, 15 April 2012 09:09 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 760
Registered: July 2009
Location: Hamburg
Senior Member
The import URI mechanism will not work in this setting.
You should try to use importNamespace instead, and configure the
reachable resources using the classpath.

Am 13.04.12 07:11, schrieb Kagan Turgut:
> I have two "split" grammars created separately into their own projects.
> The grammars are summarized as follows:
>
> Foo: extends XType
> ...
> ComponentType:
> 'componentType' name = ID ('configuration' configuration =
> JvmTypeReference)? ;
> ;
>
> Bar: extends XBase
> ...
> import "..company.com/foo/Foo" as foo
> ...
> Component:
> {Component}
> type=[foo::ComponentType|QualifiedName] name=ValidID
> ;
> ...
> ;
>
> I overrode default ImportUriGlobalScopeProvider as follows:
>
> protected LinkedHashSet<URI> getImportedUris(Resource resource) {
> LinkedHashSet<URI> temp = super.getImportedUris(resource);
> temp.add(URI.createURI("platform:/plugin/path/to/foo/file/cxf.foo"));
> return temp;
> }
>
> When I have both .foo and .bar files in the same workspace, it is able
> to locate ComponentType as well as the Configuration of the ComponentType.
> However, when the .foo file is in parent workspace, or deployed in
> dropins folder, then it can find the ComponentType but navigating to
> ComponentType.configuration results in JvmVoid as opposed to
> JvmGenericType.
>
> I suspect this is happening since FooScopeProvider is not delegating to
> BarScopeProvider. I appreciate any feedback as I am debugging into how
> to best do this... Best regards,
> Kagan


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com


---
Get professional support from the Xtext committers at www.typefox.io
Re: cross referencing resource contents of another language [message #851839 is a reply to message #845653] Sat, 21 April 2012 11:16 Go to previous message
Kagan Turgut is currently offline Kagan TurgutFriend
Messages: 3
Registered: April 2012
Location: San Francisco
Junior Member

Thanks Jan for your feedback. I had a separate chat with Sebastian who pointed out that this is basically a classpath issue. He suggested creating a smarter IJvmTypeProvider which can implicitly add the projects that have the .foo files which contains the ComponentTypes into the classpath.

For a quick test, if I explicitly set the classpath, the validation errors on locating the ComponentType.configuration dissapeared.

IJvmTypeProvider has two concrete implementations: It seems I have to override both ClasspathTypeProvider used in pure runtime, and JdtTypeProvider

[Updated on: Sun, 22 April 2012 01:19]

Report message to a moderator

Previous Topic:Why such warnings occur
Next Topic:Possible bug due to keywords with "special" chars
Goto Forum:
  


Current Time: Thu Apr 18 07:48:51 GMT 2024

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

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

Back to the top