Skip to main content



      Home
Home » Modeling » TMF (Xtext) » [Solved] How to configure a custom QualifiedNameProvider?(Guice binding error)
[Solved] How to configure a custom QualifiedNameProvider? [message #879797] Thu, 31 May 2012 17:28 Go to next message
Eclipse UserFriend
I've created a custom QualifiedName provider (extends DefaultDeclarativeQualifiedNameProvider) and configured in the Runtime module as follows:

public class OoaRuntimeModule extends org.domainmodels.AbstractOoaRuntimeModule {

    @Override
    public void configure(Binder binder) {
        super.configure(binder);
        binder
        .bind(IQualifiedNameProvider.class)
        .to(OoaQualifiedNameProvider.class);
    }
}


When I try to create a runtime instance however Guice throws an exception:

1) A binding to org.eclipse.xtext.naming.IQualifiedNameProvider was already configured at org.eclipse.xtext.service.MethodBasedModule.configure(MethodBasedModule.java:55).
  at org.domainmodels.OoaRuntimeModule.configure(OoaRuntimeModule.java:27)

I tried commenting out the fragment in the .mwe2 file but to no avail.

      //fragment = exporting.QualifiedNamesFragment {}


What am I missing? Thanks.

[Updated on: Fri, 01 June 2012 03:36] by Moderator

Re: How to configure a custom QualifiedNameProvider? [message #879802 is a reply to message #879797] Thu, 31 May 2012 17:39 Go to previous messageGo to next message
Eclipse UserFriend
On 2012-31-05 23:28, Scott Finnie wrote:
> I've created a custom QualifiedName provider (extends
> DefaultDeclarativeQualifiedNameProvider) and configured in the Runtime
> module as follows:
>
> public class OoaRuntimeModule extends
> org.domainmodels.AbstractOoaRuntimeModule {
>
> @Override
> public void configure(Binder binder) {
> super.configure(binder);
> binder
> .bind(IQualifiedNameProvider.class)
> .to(OoaQualifiedNameProvider.class);
> }
> }
>
>
> When I try to create a runtime instance however Guice throws an exception:
>
> 1) A binding to org.eclipse.xtext.naming.IQualifiedNameProvider was
> already configured at
> org.eclipse.xtext.service.MethodBasedModule.configure(MethodBasedModule.java:55).
>
> at org.domainmodels.OoaRuntimeModule.configure(OoaRuntimeModule.java:27)
>
> I tried commenting out the fragment in the .mwe2 file but to no avail.
> //fragment = exporting.QualifiedNamesFragment {}
>
>
> What am I missing? Thanks.
The interface is bound to an implementation elsewhere. Look for a method
called something like bindIQualifiedNameProvider and override it to
perform your own binding. (I have not looked what it is actually called,
look up the inheritance chain from your module as a starting point.

Regards
- henrik
Re: How to configure a custom QualifiedNameProvider? [message #879952 is a reply to message #879802] Fri, 01 June 2012 03:35 Go to previous message
Eclipse UserFriend
Solved.

Quote:
Look for a method
called something like bindIQualifiedNameProvider and override it


Thanks. I thought that including the binding in OoaRuntimeModule.configure() would do the trick but it doesn't. However it works with a specific override, i.e. defining in OoaRuntimeModule.bindIQualifiedNameProvider().


Previous Topic:Problem with imported model when referencing Xbase and JavaVMTypes models
Next Topic:Xbase: overwrite the Operator '='
Goto Forum:
  


Current Time: Wed Jul 09 23:11:54 EDT 2025

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

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

Back to the top