Skip to main content



      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 01:11 Go to next message
Eclipse UserFriend
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 05:09 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: cross referencing resource contents of another language [message #851839 is a reply to message #845653] Sat, 21 April 2012 07:16 Go to previous message
Eclipse UserFriend
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: Sat, 21 April 2012 21:19] by Moderator

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


Current Time: Wed Jul 23 14:25:26 EDT 2025

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

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

Back to the top