Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Register a ToolBar in an e4 view
Register a ToolBar in an e4 view [message #1755011] Sun, 26 February 2017 12:42
Vivien Jovet is currently offline Vivien JovetFriend
Messages: 11
Registered: February 2017
Junior Member

I'm try to add a ToolBar inside a e4 view using a ToolBarManager and commands that look like this:

I create the ToolBar like this:
ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
// CommandFactory just create CommandContributionItem with the provided ID
toolBarManager.add(CommandFactory.makeCommandItem(IWorkbenchCommandConstants.EDIT_DELETE, CommandFactory.STYLE_PUSH));
toolBarManager.add(CommandFactory.makeCommandItem(FlowConstants.ID_COMMAND_ADD_PROPERTY, CommandFactory.STYLE_PUSH));
inputToolbar = toolBarManager.createControl(tab);

The ToolBar appears and the commands work but the problem is that the buttons of the ToolBar are not updated with the selection (enabled/disabled state). They are only updated when the popup context menu of the table appears (which is using the same commands).

To register the popup context menu of the table I use the injected EMenuService:
menuService.registerContextMenu(viewer.getControl(), menuId);

It works great for popup context menu, is there a similar service for populating and registering ToolBars?
Previous Topic:JDT bootclasspath problem
Next Topic:Mark eclipse editor as not dirty if there aren't any changes
Goto Forum:

Current Time: Thu Aug 11 02:52:54 GMT 2022

Powered by FUDForum. Page generated in 0.01521 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top