|
|
|
Re: need EventBroker as OSGi Service [message #904115 is a reply to message #904089] |
Mon, 27 August 2012 19:50 |
Eclipse User |
|
|
|
For reference this
public boolean post(String topic, Object data) {
Event event = constructEvent(topic, data);
EventAdmin eventAdmin = Activator.getDefault().getEventAdmin();
if (eventAdmin == null) {
logger.error(NLS.bind(ServiceMessages.NO_EVENT_ADMIN, event.toString()));
return false;
}
eventAdmin.postEvent(event);
return true;
}
@SuppressWarnings("unchecked")
private Event constructEvent(String topic, Object data) {
Event event;
if (data instanceof Dictionary<?,?>) {
event = new Event(topic, (Dictionary<String,?>)data);
} else if (data instanceof Map<?,?>) {
event = new Event(topic, (Map<String,?>)data);
} else {
Dictionary<String, Object> d = new Hashtable<String, Object>(2);
d.put(EventConstants.EVENT_TOPIC, topic);
if (data != null)
d.put(IEventBroker.DATA, data);
event = new Event(topic, d);
}
return event;
}
is the EB post method and you can see how the e4 event is wrapped in an EventAdmin event and posted.
|
|
|
|
|
Re: need EventBroker as OSGi Service [message #1691088 is a reply to message #904549] |
Thu, 02 April 2015 08:55 |
|
Hi Fabio,
very useful post.
However, I do not get this:
Quote:1) Create a declarative service that provides
org.eclipse.e4.core.services.log.Logger (this is needed by the
implementation EventBroker which requires a Logger service)
Could you clarify this a bit..?
Thank you very much.
In my case, setting an equinox Logger to the Eclipse context won't work either:
eclipseCtx.set(Logger.class, null);
I can't get rid of the Unable to process "EventBroker.logger" error.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03838 seconds