-->

Updating UI contributions on Handler switch in e4

2019-06-20 04:13发布

问题:

I have defined a command global to my e4 application, namely the add command. So, as you can see in the command is to used throughout the application (1) and to the repsective handler to be activated on context switch to the resp. parts in (2) and (3).

Now what I am missing, is the possibility to update all UI contributions like (4) allocated to command (1) with the information such as in (2) add contact, and when switching to (3) add account.

What is the general recommended way to update all UI contributions of a command considering the actual context of the command (which handler is active etc.). In Eclipse 3.x we had something like the IElementUpdater which was taking care of doing the respective update.

Thanks for your hints! - Parallely discussed in Eclipse Forum

I worked on finding a solution, and have outlined the current state in my blog.

回答1:

You can inject IEventBroker in your class and below statement, this statement will check for all UI enablement in application

    eventBroker.send(UIEvents.REQUEST_ENABLEMENT_UPDATE_TOPIC, UIEvents.ALL_ELEMENT_ID);