Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [xtext2] Scoping & Fragments
[xtext2] Scoping & Fragments [message #692798] Tue, 05 July 2011 09:10 Go to next message
n.lincke is currently offline n.linckeFriend
Messages: 11
Registered: April 2011
Junior Member
Good morning community,

I have a question (What a surprise, I know).

I am facing some scoping problems including the thing where I only want that the elements in one file are only usable in the same file and not in all others to.

I know what I have to do to accomplish this task (ImportURIScopingFragment ...) but I also need some of the functionality of the ImportNamespacesScopingFragment.

So my first question is: I need to create my own fragment, which handles the things like I want it to, right?

I have tried this, but it didn't work. I created a class, which extends AbstractScopingFragment, and created an XPand file with the same name. But it don't work! It always shows me the following error:

 EvaluationException : No Definition 'AbstractScopingFragment::JavaScopeProvider(String) for org::eclipse::xtext::impl::GrammarImpl' found!


I found some hints, what this could all about but nothing really helped me... I also get this error when I just copy the codelines from ImportNamespacesScopingFragment in to the new fragment with the new name...

Am I on the right way? Is there a better solution? What am I doing wrong?

I just want the standard behavior without the ability to use a element from another file, which is not explicit included...
I am using XTEXT 2...

Thanks a lot for your input...
Re: [xtext2] Scoping & Fragments [message #692853 is a reply to message #692798] Tue, 05 July 2011 11:00 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3108
Registered: July 2009
Senior Member
Hi,

you don't have to provide your own generator fragment. Both scoping
fragments simply define some bindings in the Guice module and create a
stub scope provider that you can implement. If you don't need to
implement your scoping semantics in many different languages, it's
simpler to just add the bindings manually.

The easiest way would be to override
ImportedNamespaceAwareLocalScopeProvider.getResourceScope(Resource,
EReference) and implement the desired behavior there.

Does that help?

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

On 05.07.11 11:10, forums-noreply@eclipse.org wrote:
> Good morning community,
> I have a question (What a surprise, I know).
>
> I am facing some scoping problems including the thing where I only want
> that the elements in one file are only usable in the same file and not
> in all others to.
> I know what I have to do to accomplish this task
> (ImportURIScopingFragment ...) but I also need some of the functionality
> of the ImportNamespacesScopingFragment.
> So my first question is: I need to create my own fragment, which handles
> the things like I want it to, right?
>
> I have tried this, but it didn't work. I created a class, which extends
> AbstractScopingFragment, and created an XPand file with the same name.
> But it don't work! It always shows me the following error:
>
> EvaluationException : No Definition
> 'AbstractScopingFragment::JavaScopeProvider(String) for
> org::eclipse::xtext::impl::GrammarImpl' found!
>
>
> I found some hints, what this could all about but nothing really helped
> me... I also get this error when I just copy the codelines from
> ImportNamespacesScopingFragment in to the new fragment with the new name...
>
> Am I on the right way? Is there a better solution? What am I doing wrong?
>
> I just want the standard behavior without the ability to use a element
> from another file, which is not explicit included...
> I am using XTEXT 2...
>
> Thanks a lot for your input...
>
Re: [xtext2] Scoping & Fragments [message #693840 is a reply to message #692853] Thu, 07 July 2011 10:03 Go to previous messageGo to next message
Nico Lincke is currently offline Nico LinckeFriend
Messages: 9
Registered: July 2011
Junior Member
Yes, thank you!

This was a solution. But I am wondering what have I made wrong, with my fragment... I don't really need this at the moment but I always like to understand things so can you (or someone else) point me to an example or something? Or is there something about fragment creation in the documentation what I have, overread?

(By the way: does anyone know how i could delete an account? (I created this thread with my old account...)
Re: [xtext2] Scoping & Fragments [message #695627 is a reply to message #693840] Tue, 12 July 2011 07:49 Go to previous message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3108
Registered: July 2009
Senior Member
Hi Nico,

I'm afraid there is no detailed documentation on writing own fragments
available. You could try to learn from simpler existing fragments such
as the JavaValidatorFragment.

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

On 07.07.11 12:03, Nico Lincke wrote:
> Yes, thank you!
> This was a solution. But I am wondering what have I made wrong, with my
> fragment... I don't really need this at the moment but I always like to
> understand things so can you (or someone else) point me to an example or
> something? Or is there something about fragment creation in the
> documentation what I have, overread?
>
> (By the way: does anyone know how i could delete an account? (I created
> this thread with my old account...)
Previous Topic:Multiple ANTLR versions using Xtext and third party library in a standalone application
Next Topic:Restricting cross-refference content assist
Goto Forum:
  


Current Time: Wed Sep 23 10:14:16 GMT 2020

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

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

Back to the top