Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [Xtext] scope provider migration - DI issue?
[Xtext] scope provider migration - DI issue? [message #1061967] Wed, 05 June 2013 07:48 Go to next message
Volker Wegert is currently offline Volker WegertFriend
Messages: 176
Registered: July 2009
Senior Member
Hello,

I'm in the process of upgrading a tool that uses Xtext to the current
versions. This project has not been touched for almost a year. Now,
after upgrading the dependencies and smoothing out the obvious wrinkles,
I'm stuck because the custom scope provider (built using Xtend) is no
longer called. I've tried to wrap my head around the way things are
supposed to work, and I'm unsure on how to fix it. The obvious way would
be to edit the class MyDSLRuntimeModule and override the method
bindIScopeProvider() that is inherited from the generated class
AbstractMyDSLRuntimeModule, but this yields a series of Guice errors.
How am I supposed to "register" my custom scope provider in current
versions of Xtext?

Thanks
Volker
Re: [Xtext] scope provider migration - DI issue? [message #1061971 is a reply to message #1061967] Wed, 05 June 2013 07:56 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13488
Registered: July 2009
Senior Member
Hi
Can you give a bit more context.
Which is the version you are coming from (you may have a look at mig
guides in docs)
XBase/no Xbase what is the error you get.
Besides this it may help to create a new project with the wizard and
compare.

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [Xtext] scope provider migration - DI issue? [message #1061976 is a reply to message #1061971] Wed, 05 June 2013 08:25 Go to previous messageGo to next message
Volker Wegert is currently offline Volker WegertFriend
Messages: 176
Registered: July 2009
Senior Member
Am 05.06.2013 09:56, schrieb Christian Dietrich:
> Which is the version you are coming from (you may have a look at mig guides in docs)

I'm upgrading from 2.2.1.v201112130541 to 2.4.1.v201304180855.

> (you may have a look at mig guides in docs)

http://www.eclipse.org/Xtext/documentation.html only provides migration guides from 0.7 to 1.0 and from 1.0 to 2.0. So do the online
documentation and the PDF documentation supplied from the site.

> XBase/no Xbase what is the error you get.

Without changes to MyDSLRuntimeModule, the scope provider is simply not called (no error message, references are not resolved in the
editor).

If I add this to MyDSLRuntimeModule

@Override
public Class<? extends IScopeProvider> bindIScopeProvider() {
return de.mycompany.mydsl.scoping.MyDSLScopeProvider.class;
}

I get the following error messages

!MESSAGE de.mycompany.mydsl.ui.internal.MyDSLActivator - Failed to create injector for de.mycompany.mydsl.MyDSL
6 [main] ERROR de.mycompany.mydsl.ui.internal.MyDSLActivator - Guice creation errors:
1) No implementation for org.eclipse.xtext.scoping.IScopeProvider annotated with
@com.google.inject.name.Named(value=org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider.delegate) was bound.
while locating org.eclipse.xtext.scoping.IScopeProvider annotated with
@com.google.inject.name.Named(value=org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider.delegate)
for field at org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider.delegate(Unknown Source)
at org.eclipse.xtext.service.MethodBasedModule.configure(MethodBasedModule.java:55)

From this, I assumed that extending the RuntimeModule is not the way to go - but what is it, then?

> Besides this it may help to create a new project with the wizard and
> compare.

The new project does not contain any scope provider at all, so I'm stuck with the same question - how do I get the runtime to use my
scope provider? The documentation is really cool and goes to great lengths to explain how to do the most complex tasks, but
apparently I've overlooked the part where it tells me how to do the basic stuff first...

Thanks
Volker
Re: [Xtext] scope provider migration - DI issue? [message #1061983 is a reply to message #1061976] Wed, 05 June 2013 09:02 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13488
Registered: July 2009
Senior Member
Sure regarding the new project? Did you run the workflow

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [Xtext] scope provider migration - DI issue? [message #1062068 is a reply to message #1061976] Wed, 05 June 2013 16:26 Go to previous messageGo to next message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 672
Registered: July 2009
Location: Trondheim, Norway
Senior Member
Hi,

If you look in the abstract runtime module for bindings related to Scope
you should find 1) what bindings are needed and 2) which (super)classes
you must ensure to call from your own classes. I use Xbase and have the
following bindings:

I a similar migration and now use the following bindings:

// originally contributed by
org.eclipse.xtext.generator.xbase.XbaseGeneratorFragment
public Class<? extends org.eclipse.xtext.scoping.IScopeProvider>
bindIScopeProvider() {
return org.ptolemy.xtext.scoping.XActorScopeProvider.class;
}

// originally contributed by
org.eclipse.xtext.generator.xbase.XbaseGeneratorFragment
public Class<? extends
org.eclipse.xtext.xbase.scoping.batch.XbaseBatchScopeProvider>
bindXbaseBatchScopeProvider() {
return org.ptolemy.xtext.scoping.XActorBatchScopeProvider.class;
}

// contributed by org.eclipse.xtext.generator.xbase.XbaseGeneratorFragment
public void configureSerializerIScopeProvider(com.google.inject.Binder
binder) {

binder.bind(org.eclipse.xtext.scoping.IScopeProvider.class).annotatedWith(org.eclipse.xtext.serializer.tokens.SerializerScopeProviderBinding.class).to(org.ptolemy.xtext.scoping.XActorSerializerScopeProvider.class);
}

Hallvard

On 05.06.13 01.25, Volker Wegert wrote:
> Am 05.06.2013 09:56, schrieb Christian Dietrich:
> > Which is the version you are coming from (you may have a look at mig
> guides in docs)
>
> I'm upgrading from 2.2.1.v201112130541 to 2.4.1.v201304180855.
>
> > (you may have a look at mig guides in docs)
>
> http://www.eclipse.org/Xtext/documentation.html only provides migration
> guides from 0.7 to 1.0 and from 1.0 to 2.0. So do the online
> documentation and the PDF documentation supplied from the site.
>
> > XBase/no Xbase what is the error you get.
>
> Without changes to MyDSLRuntimeModule, the scope provider is simply not
> called (no error message, references are not resolved in the editor).
>
> If I add this to MyDSLRuntimeModule
>
> @Override
> public Class<? extends IScopeProvider> bindIScopeProvider() {
> return de.mycompany.mydsl.scoping.MyDSLScopeProvider.class;
> }
>
> I get the following error messages
>
> !MESSAGE de.mycompany.mydsl.ui.internal.MyDSLActivator - Failed to
> create injector for de.mycompany.mydsl.MyDSL
> 6 [main] ERROR de.mycompany.mydsl.ui.internal.MyDSLActivator - Guice
> creation errors:
> 1) No implementation for org.eclipse.xtext.scoping.IScopeProvider
> annotated with
> @com.google.inject.name.Named(value=org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider.delegate)
> was bound.
> while locating org.eclipse.xtext.scoping.IScopeProvider annotated
> with
> @com.google.inject.name.Named(value=org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider.delegate)
>
> for field at
> org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider.delegate(Unknown
> Source)
> at
> org.eclipse.xtext.service.MethodBasedModule.configure(MethodBasedModule.java:55)
>
>
> From this, I assumed that extending the RuntimeModule is not the way to
> go - but what is it, then?
>
> > Besides this it may help to create a new project with the wizard and
> > compare.
>
> The new project does not contain any scope provider at all, so I'm stuck
> with the same question - how do I get the runtime to use my scope
> provider? The documentation is really cool and goes to great lengths to
> explain how to do the most complex tasks, but apparently I've overlooked
> the part where it tells me how to do the basic stuff first...
>
> Thanks
> Volker
>
>
Re: [Xtext] scope provider migration - DI issue? [message #1062709 is a reply to message #1061967] Mon, 10 June 2013 12:50 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3108
Registered: July 2009
Senior Member
Am 05.06.13 09:48, schrieb Volker Wegert:
> Hello,
>
> I'm in the process of upgrading a tool that uses Xtext to the current
> versions. This project has not been touched for almost a year. Now,
> after upgrading the dependencies and smoothing out the obvious wrinkles,
> I'm stuck because the custom scope provider (built using Xtend) is no
> longer called. I've tried to wrap my head around the way things are
> supposed to work, and I'm unsure on how to fix it. The obvious way would
> be to edit the class MyDSLRuntimeModule and override the method
> bindIScopeProvider() that is inherited from the generated class
> AbstractMyDSLRuntimeModule, but this yields a series of Guice errors.
> How am I supposed to "register" my custom scope provider in current
> versions of Xtext?
>
> Thanks
> Volker

Please try with 2.4.2. There was a bug which was recently fixed in-time
for 2.4.2

Regards,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com
Re: [Xtext] scope provider migration - DI issue? [message #1146505 is a reply to message #1062709] Sun, 20 October 2013 07:35 Go to previous message
Hirdesh Agrawal is currently offline Hirdesh AgrawalFriend
Messages: 13
Registered: October 2013
Junior Member
Dear All,

I need your favor or suggestion regarding migrate the xtext version from 1.0.1 to 2.3.0 in SME application.

I followed all following process for migrate the xtext version.
1. Delete the old plug-ins and update the latest plug-ins in target platform.
2. Update the Plug-in Dependencies and Import Statements.
3. Introduction of the Qualified Name.
4. Changes in the index and in find references.
5. Rewritten Node Model.
6. AutoEditStrategy.
7. Other Noteworthy API Changes
To consider the above steps, I started the work with Eclipse-4.2, Which has a xtext-2.3.0 dependency. Successfully I completed the all above steps and removed the compilation error.

Problem: After that I start the testing and getting below error Messages:
[XtextLinkingDiagnostic: null:6 Couldn't resolve reference to Material 'MPS_RECUR'.,
XtextLinkingDiagnostic: null:9 Couldn't resolve reference to Cstic 'NUM_OF_ALLOC'.,
XtextLinkingDiagnostic: null:15 Couldn't resolve reference to Cstic 'INSTANCE_NUM'.,
XtextLinkingDiagnostic: null:14 Couldn't resolve reference to Class 'ALLOC'.]
Previous Topic:Lexing/parsing advice sought
Next Topic:Issue with scope provider in Xtext 2.4
Goto Forum:
  


Current Time: Sat Jul 04 05:46:32 GMT 2020

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

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

Back to the top