1 year ago

#330620

test-img

Fabian Deitelhoff

Eclipse RCP Updating Toolbar and Menu Entries

I am using menu entries and toolbar buttons to link them to actions (AbstractHandler).

For example, I can connect to or disconnect from hardware. If I connect, there are menu and toolbar entries dependent on the connection state. They update after I click in the view or do another action within the view. For UX improvements it would be nice if they update after the action was executed.

Is there a way to update the view programmatically or do I have to implement this differently?

The connect handler is implemented very simple:

public class ConnectHandler extends AbstractHandler {
    @Override
    public Object execute(ExecutionEvent event) throws ExecutionException {
        // Connect to hardware.
        return null;
    }
}

The menu and toolbar entries are defined in the plugin.xml.

I tried some stuff with the ICommandService and refreshElements, but was unsuccessful.

eclipse

eclipse-rcp

0 Answers

Your Answer

Accepted video resources