Project: Eclipse_Platform_UI
Bug 376254 Create new model Add-on HandlerProcessingAddon to replace calling E4Workbench.processHierarchy
Reported: 2012-04-06 09:37:07 | Status: resolved fixed

Beside adding content to the Workbench Model via Fragments or Modell Processors i am potentially also able to do it completely programmatically by using Factories e.g in a postConstruct-Method of part. Sample: @PostConstruct private void postConstruct(MApplication application, MTrimmedWindow trimmedWindow) { // Command erzeugen MCommand exitCommand = MCommandsFactory.INSTANCE.createCommand(); exitCommand.setElementId("net.teufel.e4.helloworld.exitCommand"); exitCommand.setCommandName("ExitCommand"); application.getCommands().add(exitCommand); // Handler erzeugen MHandler exitHandler = MCommandsFactory.INSTANCE.createHandler(); exitHandler.setElementId("net.teufel.e4.helloworld.handlers.exitHandler"); exitHandler.setContributionURI("bundleclass://net.teufel.e4.helloworld.ui/net.teufel.e4.helloworld.handlers.ExitHandler"); exitHandler.setCommand(exitCommand); application.getHandlers().add(exitHandler); // Toolbar erzeugen MToolBar myToolbar = MMenuFactory.INSTANCE.createToolBar(); MHandledToolItem exitToolItem=MMenuFactory.INSTANCE.createHandledToolItem(); exitToolItem.setElementId("net.teufel.e4.helloworld.toolitems.exitToolItem"); exitToolItem.setLabel("Beenden"); exitToolItem.setIconURI("platform:/plugin/net.teufel.e4.helloworld.ui/icons/door_out.png"); exitToolItem.setCommand(exitCommand); exitToolItem.setEnabled(true); myToolbar.getChildren().add(exitToolItem); // Trimbar erzeugen und zum Fenster hinzufuegen MTrimBar myTrimBar = MBasicFactory.INSTANCE.createTrimBar(); myTrimBar.getChildren().add(myToolbar); trimmedWindow.getTrimBars().add(myTrimBar); //E4Workbench.processHierarchy(application); } My problem is the following: When creating this toolbar manually I need to call E4Workbench.processHierarchy (the last commented line in the code) manually in order to get the toolbar enabled. Otherwise it stays disabled. Is it really necessary to call processHierarchy each time when i do manual changes in the model?

Files changed in fix:
bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/PartRenderingEngine.java bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/E4Workbench.java bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/addons/HandlerProcessingAddon.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/Bug320857Test.java tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/EPartServiceTest.java tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/ESelectionServiceTest.java tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/HeadlessApplicationTest.java tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/MMenuItemTest.java