Source:
public Object createWidget(final MUIElement element, Object parent) { if (!(element instanceof MToolControl) || !(parent instanceof ToolBar || parent instanceof Composite)) return null; Composite parentComp = (Composite) parent; MToolControl toolControl = (MToolControl) element; if (((Object) toolControl.getParent()) instanceof MToolBar) { IRendererFactory factory = context.get(IRendererFactory.class); AbstractPartRenderer renderer = factory.getRenderer( toolControl.getParent(), parent); if (renderer instanceof ToolBarManagerRenderer) { return null; } } Widget parentWidget = (Widget) parent; IEclipseContext parentContext = getContextForParent(element); ToolItem sep = null; if (parent instanceof ToolBar) { sep = new ToolItem((ToolBar) parentWidget, SWT.SEPARATOR); } IContributionFactory contributionFactory = parentContext .get(IContributionFactory.class); IEclipseContext localContext = EclipseContextFactory.create(); localContext.set(Composite.class.getName(), parentComp); localContext.set(MToolControl.class.getName(), toolControl); Object tcImpl = contributionFactory.create( toolControl.getContributionURI(), parentContext, localContext); toolControl.setObject(tcImpl); Control[] kids = parentComp.getChildren(); if (kids.length == 0) return null; Control newCtrl = kids[kids.length - 1]; if (sep != null && newCtrl != null) { sep.setControl(newCtrl); newCtrl.pack(); sep.setWidth(newCtrl.getSize().x); } setCSSInfo(toolControl, newCtrl); boolean vertical = false; MUIElement parentElement = element.getParent(); if (parentElement instanceof MTrimBar) { MTrimBar bar = (MTrimBar) parentElement; vertical = bar.getSide() == SideValue.LEFT || bar.getSide() == SideValue.RIGHT; } CSSRenderingUtils cssUtils = parentContext.get(CSSRenderingUtils.class); newCtrl = cssUtils.frameMeIfPossible(newCtrl, null, vertical, true); createToolbarMenu(toolControl, newCtrl); return newCtrl; }

Target:
public Object createWidget(final MUIElement element, Object parent) { if (!(element instanceof MToolControl) || !(parent instanceof ToolBar || parent instanceof Composite)) return null; Composite parentComp = (Composite) parent; MToolControl toolControl = (MToolControl) element; if (((Object) toolControl.getParent()) instanceof MToolBar) { IRendererFactory factory = context.get(IRendererFactory.class); AbstractPartRenderer renderer = factory.getRenderer( toolControl.getParent(), parent); if (renderer instanceof ToolBarManagerRenderer) { return null; } } Widget parentWidget = (Widget) parent; IEclipseContext parentContext = getContextForParent(element); ToolItem sep = null; if (parent instanceof ToolBar) { sep = new ToolItem((ToolBar) parentWidget, SWT.SEPARATOR); } IContributionFactory contributionFactory = parentContext .get(IContributionFactory.class); IEclipseContext localContext = EclipseContextFactory.create(); localContext.set(Composite.class.getName(), parentComp); localContext.set(MToolControl.class.getName(), toolControl); Object tcImpl = contributionFactory.create( toolControl.getContributionURI(), parentContext, localContext); toolControl.setObject(tcImpl); Control[] kids = parentComp.getChildren(); if (kids.length == 0) return null; Control newCtrl = kids[kids.length - 1]; if (sep != null && newCtrl != null) { sep.setControl(newCtrl); newCtrl.pack(); sep.setWidth(newCtrl.getSize().x); } setCSSInfo(toolControl, newCtrl); boolean vertical = false; MUIElement parentElement = element.getParent(); if (parentElement instanceof MTrimBar) { MTrimBar bar = (MTrimBar) parentElement; vertical = bar.getSide() == SideValue.LEFT || bar.getSide() == SideValue.RIGHT; } CSSRenderingUtils cssUtils = parentContext.get(CSSRenderingUtils.class); newCtrl = cssUtils.frameMeIfPossible(newCtrl, null, vertical, true); createToolControlMenu(toolControl, newCtrl); return newCtrl; }