Source:
void populateTopTrimContributions() { getCoolBarManager2().update(true); getCoolBarManager2().add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); final MTrimBar trimBar = getTopTrim(); MToolControl spacerControl = (MToolControl) modelService.find(PERSPECTIVE_SPACER_ID, model); if (spacerControl == null) { spacerControl = modelService.createModelElement(MToolControl.class); spacerControl.setElementId(PERSPECTIVE_SPACER_ID); spacerControl .setContributionURI("bundleclass://org.eclipse.e4.ui.workbench.renderers.swt/org.eclipse.e4.ui.workbench.renderers.swt.LayoutModifierToolControl"); spacerControl.getTags().add(TrimBarLayout.SPACER); trimBar.getChildren().add(spacerControl); } MToolControl switcherControl = (MToolControl) modelService.find( "PerspectiveSwitcher", model); if (switcherControl == null && getWindowConfigurer().getShowPerspectiveBar()) { switcherControl = modelService.createModelElement(MToolControl.class); switcherControl.setToBeRendered(getWindowConfigurer().getShowPerspectiveBar()); switcherControl.setElementId("PerspectiveSwitcher"); switcherControl.getTags().add(IPresentationEngine.DRAGGABLE); switcherControl.getTags().add("HIDEABLE"); switcherControl.getTags().add("SHOW_RESTORE_MENU"); switcherControl .setContributionURI("bundleclass://org.eclipse.ui.workbench/org.eclipse.e4.ui.workbench.addons.perspectiveswitcher.PerspectiveSwitcher"); trimBar.getChildren().add(switcherControl); } else if (switcherControl != null && !getWindowConfigurer().getShowPerspectiveBar()) { trimBar.getChildren().remove(switcherControl); } updateLayoutDataForContents(); }

Target:
void populateTopTrimContributions() { getCoolBarManager2().update(true); getCoolBarManager2().add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); final MTrimBar trimBar = getTopTrim(); MToolControl spacerControl = (MToolControl) modelService.find(PERSPECTIVE_SPACER_ID, model); if (spacerControl == null) { spacerControl = modelService.createModelElement(MToolControl.class); spacerControl.setElementId(PERSPECTIVE_SPACER_ID); spacerControl .setContributionURI("bundleclass://org.eclipse.e4.ui.workbench.renderers.swt/org.eclipse.e4.ui.workbench.renderers.swt.LayoutModifierToolControl"); spacerControl.getTags().add(TrimBarLayout.SPACER); spacerControl.getTags().add("SHOW_RESTORE_MENU"); trimBar.getChildren().add(spacerControl); } MToolControl switcherControl = (MToolControl) modelService.find( "PerspectiveSwitcher", model); if (switcherControl == null && getWindowConfigurer().getShowPerspectiveBar()) { switcherControl = modelService.createModelElement(MToolControl.class); switcherControl.setToBeRendered(getWindowConfigurer().getShowPerspectiveBar()); switcherControl.setElementId("PerspectiveSwitcher"); switcherControl.getTags().add(IPresentationEngine.DRAGGABLE); switcherControl.getTags().add("HIDEABLE"); switcherControl .setContributionURI("bundleclass://org.eclipse.ui.workbench/org.eclipse.e4.ui.workbench.addons.perspectiveswitcher.PerspectiveSwitcher"); trimBar.getChildren().add(switcherControl); } else if (switcherControl != null && !getWindowConfigurer().getShowPerspectiveBar()) { trimBar.getChildren().remove(switcherControl); } updateLayoutDataForContents(); }