How to update/refresh a view in an eclipse plug-in?

前端 未结 2 649
别跟我提以往
别跟我提以往 2021-01-03 10:01

I have an eclipse plug-in with a single view (like the eclipse helloworld-view-plugin-project). In the view-file I get an event whe

2条回答
  •  时光说笑
    2021-01-03 10:45

    I finally found the answer (together with AndreiC's help!):

    my listener now looks like this:

    r.addPropertyChangeListener(BindingNames.SERVICE_ADDED, new PropertyChangeListener() {
      public void propertyChange(final PropertyChangeEvent evt) {   
        Display.getDefault().asyncExec(new Runnable() {
          public void run() {
             // remove grpYourStatus from parent
             grpYourStatus.dispose();
    
             // add grpYourStatus (with updated values) to parent
             createStatusGroupBox();
    
             // refresh view
             parent.pack();
             parent.layout(true);
          }
        });
      }
    });
    

    The rest is the same like the code above.

提交回复
热议问题