Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 21:28 Go to next message
Scott Finnie is currently offline Scott FinnieFriend
Messages: 94
Registered: October 2011
Member
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 07:36]

Report message to a moderator

Re: How to configure a custom QualifiedNameProvider? [message #879802 is a reply to message #879797] Thu, 31 May 2012 21:39 Go to previous messageGo to next message
Henrik Lindberg is currently offline Henrik LindbergFriend
Messages: 2509
Registered: July 2009
Senior Member
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 07:35 Go to previous message
Scott Finnie is currently offline Scott FinnieFriend
Messages: 94
Registered: October 2011
Member
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: Thu Dec 03 08:40:25 GMT 2020

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

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

Back to the top