Community
Participate
Working Groups
Events send (or posted) by IEventBroker are not received in methods the argument of which is annotated with @UIEventTopic. Steps to reproduce: 1. Import attached project into workspace (of Eclipse 4.3, e4 0.14 or nightly) 2. Run plugin project as 'Eclipse application'. 3. Select 'send' in main menu. Expected result: Broker in menu button handler (class MenuHandler) posts a message that is received by Receiver.onMessage() method. Actual result: broker.post() is called in MenuHandler. However Receiver.onMessage() is not. According to log messages in console view the Redeiver class is properly initialized (constructor is called). Bug appears after upgrade to Eclipse 4.3, e4 0.14. It works fine with Eclipse 4.2 and e4 0.13.
Created attachment 233249 [details] demo project forgotten sample project in attachement
You are using new to create your Receiver instance. This way it is not registered with the framework as receiver. Try Receiver receiver = ContextInjectionFactory.make(Receiver.class, context);
Created attachment 233358 [details] demo project v2 I've slightly altered the demo project. Receiver is now registrated by following code: Receiver receiver = ContextInjectionFactory.make(Receiver.class, context); context.set(Receiver.class, receiver); It works with Juno and doesn't work with Kepler. (Direct event handling (IEventBroker.subscribe()) works on boths versions)
In org.iczerny.message.MenuHandler you can't use @Inject (can't use it in general on handlers). You have to use @Execute public void execute(IEventBroker broker) { ... } But even with that, it still doesn't work in the case where you instantiate a class with a processor. The UIEventObjectSupplier is being created as a side effect in the org.eclipse.e4.ui.internal.workbench.swt.E4Application.loadApplicationModel(IApplicationContext, IEclipseContext) processing, but the needs ContextInjectionFactory.setDefault(appContext); called before it is injected otherwise it doesn't have a uiSync object. One possible solution is to move ContextInjectionFactory.setDefault(appContext); towards the beginning of org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(IApplicationContext, Display) PW
There's a request and patch in bug 413149 for moving the default supplier setting towards the beginning of the E4Application
Looks like this was fixed in M1 by bug 413149 PW
PW, should we mark this one a DUP of bug 413149 ?