/* * (non-Javadoc) * * @see * org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands * .ExecutionEvent) */ public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbenchPart part = HandlerUtil.getActivePart(event); if (part != null) { IWorkbenchPartSite site = part.getSite(); if (site instanceof PartSite) { final MPart model = ((PartSite) site).getModel(); Composite partContainer = (Composite) model.getWidget(); if (partContainer != null) { Composite parent = partContainer.getParent(); while (parent != null && parent instanceof Composite) { if (parent instanceof CTabFolder) { CTabFolder ctf = (CTabFolder) parent; final Control topRight = ctf.getTopRight(); if (topRight instanceof Composite) { for (Control child : ((Composite) topRight).getChildren()) { if (child instanceof ToolBar && "ViewMenu".equals(child.getData())) { // $NON-NLS-1$ ToolBar tb = (ToolBar) child; ToolItem ti = tb.getItem(0); Event sevent = new Event(); sevent.type = SWT.Selection; sevent.widget = ti; ti.notifyListeners(SWT.Selection, sevent); } } } return null; } parent = parent.getParent(); } MMenu menuModel = StackRenderer.getViewMenu(model); if (menuModel != null) { showStandaloneViewMenu(event, model, menuModel, partContainer); } } } } return null; }