Hi,
I worked on the LocaleChangeService with feedback from Tom. Several facts:
1. The LocaleChangeService is not a OSGi service, but will be created via context function.
2. It has additional methods for setting the Locale via String, which is in respect to the TranslationService.LOCALE that is represented as String also.
3. There is an event fired on Locale change.
4. The model update is triggered directly (so the event might not be necessary, but who knows all use cases a user might have).
5. The Locale needs to be set to the OSGi context and not the application context, as the model seems to only checking the OSGi context.
I've implemented some functionality that iterates over the model below the MApplication and filters out all MUILabel elements. It then exectues EMF notifications to update the UI. So the update can be triggered via model and it is not necessary to listen for events in the renderers, which should simplify things a lot.
This works fine so far, but at this point the implementation gets ... well ... kind of ugly. I need to determine the concrete model implementation as I need to specify the EMF notification feature ID which is tight connected to the model. For example, to execute the EMF notification for the label of a MPart you need to execute eNotify() on PartImpl like this
PartImpl impl = (PartImpl) element;
impl.eNotify(new ENotificationImpl(impl, Notification.SET, BasicPackageImpl.PART__LABEL, oldLabel, label));
I wouldn't need to cast directly to PartImpl. Usually UIElementImpl should be good enough to call eNotify(), but I need to know about the BasicPackageImpl.PART__LABEL feature id.
This would leave me to implement a set of instanceof checks for every model element, so I know what feature needs to be updated in detail. Isn't there a more generic way to execute a notification that the label needs to be updated?