Community
Participate
Working Groups
ModelServiceImpl uses two methods to register its handler. @Inject public ModelServiceImpl(IEclipseContext appContext) { Objects.requireNonNull(appContext, "No application context given!"); //$NON-NLS-1$ this.appContext = appContext; Bundle bundle = FrameworkUtil.getBundle(getClass()); if (bundle != null) { // handle OSGi case } } else { // handle non OSGi case } I suggest to remove the special handling for the OSGi case, the second approach using the IEventBroker directly also works in OSGi.
Rolf, do you have an opinion here?
It seems to me that this whole registration could be moved to an @Inject on the UIElement.TOPIC_WIDGET topic, so that no explicit registration to a IEventBroker is needed. Furthermore, I really wonder if this code (and the call to renderer#createGui) should be in the EModelService, the functionality seems less related to other methods in this class. It might have deserved its own service or addon. Also, IPresentationEngine.CUSTOM_RENDERER_KEY could be used to assign a custom renderer to the hosted elements. Such that there is no rendering code in the ModelService.