|
Re: Configuring Scope Provider Error Handler [message #759810 is a reply to message #759778] |
Wed, 30 November 2011 07:43 |
Sebastian Zarnekow Messages: 3118 Registered: July 2009 |
Senior Member |
|
|
Mirko,
did you try to bind the error handler as a class instead of the type?
bind(ErrorHandler.class).anoatedWith(...).to(..);
Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Am 30.11.11 01:45, schrieb Mirko Raner:
> Hi all,
>
> we're trying to debug some tricky scope provider issues and we just
> noticed that a number of exceptions get silently swallowed because
> AbstractDeclarativeScopeProvider by default uses a NullErrorHandler. So,
> we're trying to bind to the following injection point in ADSP:
>
> @Inject(optional=true)
> @Named(NAMED_ERROR_HANDLER)
> private PolymorphicDispatcher.ErrorHandler<IScope> errorHandler = new
> PolymorphicDispatcher.NullErrorHandler<IScope>();
> Our configure method looks like this, but it's not working (it does get
> executed, though):
>
> binder.bind(
> ((TypeLiteral<PolymorphicDispatcher.ErrorHandler<IScope>>)TypeLiteral.get(Types.newParameterizedType(PolymorphicDispatcher.ErrorHandler.class,
> IScope.class)))).
> annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_ERROR_HANDLER)).
>
> toInstance(new PolymorphicDispatcher.DefaultErrorHandler<IScope>());
> When we break in the debugger in our custom scope provider it still
> shows a NullErrorHandler as the error handler, so apparently the binding
> didn't take. We configure the binding in the runtime module that goes
> with our scope provider, but maybe that's too late?
> Any idea what we're doing wrong here?
> Thanks!
>
|
|
|
Re: Configuring Scope Provider Error Handler [message #897735 is a reply to message #759810] |
Wed, 25 July 2012 07:51 |
Sebastian Zarnekow Messages: 3118 Registered: July 2009 |
Senior Member |
|
|
For the sake of completeness: This one will do the trick:
public void configureErrorHandler(Binder binder) {
binder.bind(new TypeLiteral<PolymorphicDispatcher.ErrorHandler<IScope>>() {}).annotatedWith(
Names.named(AbstractDeclarativeScopeProvider.NAMED_ERROR_HANDLER)).to(MyErrorHandler.class);
}
static class MyErrorHandler extends PolymorphicDispatcher.DefaultErrorHandler<IScope> {
public MyErrorHandler() {
System.out.println("initialized custom error handler");
}
}
[Updated on: Wed, 25 July 2012 07:52] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04295 seconds