How to communicate between views in Eclipse RCP?

后端 未结 3 968
星月不相逢
星月不相逢 2020-12-08 05:38

In Eclipse RCP, I am creating views for the Perspective using IPageLayout.addView(...)

But this way I don\'t have a reference to the view. Therefore I d

3条回答
  •  轮回少年
    2020-12-08 06:01

    There are different ways for view and plugin communications: eventbroker, listener etc..

    EvenBroker (e4) Implementation: Use eventbroker to send message (string) between views and plugins.

    Sender Side:

    @Inject
    private IEventBroker eventBroker; 
    private static final String STATUS ="status";
    eventBroker.send(STATUS, "status test message..");
    

    Receiver Side:

    @Inject
    private IEventBroker eventBroker; 
    private static final String STATUS ="status";
    @Inject @Optional
    public void  getEvent(@UIEventTopic(STATUS) String message) {
        ... //call method 
    }
    

提交回复
热议问题