[Xtext] scope provider migration - DI issue? [message #1061967] |
Wed, 05 June 2013 03:48  |
Eclipse User |
|
|
|
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 #1062068 is a reply to message #1061976] |
Wed, 05 June 2013 12:26   |
Eclipse User |
|
|
|
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 #1146505 is a reply to message #1062709] |
Sun, 20 October 2013 03:35  |
Eclipse User |
|
|
|
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'.]
|
|
|
Powered by
FUDForum. Page generated in 0.03773 seconds