1 11 12 package org.eclipse.ui.internal; 13 14 import org.eclipse.jface.action.Action; 15 import org.eclipse.ui.IWorkbenchWindow; 16 import org.eclipse.ui.actions.ActionFactory; 17 import org.eclipse.ui.handlers.IHandlerService; 18 19 public class QuickAccessMenu extends Action implements 20 ActionFactory.IWorkbenchAction { 21 private IWorkbenchWindow workbenchWindow; 22 23 public QuickAccessMenu(IWorkbenchWindow window) { 24 super(WorkbenchMessages.QuickAccessAction_text); 25 workbenchWindow = window; 26 setToolTipText(WorkbenchMessages.QuickAccessAction_toolTip); 27 setActionDefinitionId("org.eclipse.ui.window.quickAccess"); } 29 30 35 public void run() { 36 if (workbenchWindow == null) { 37 return; 38 } 39 40 IHandlerService handlerService = (IHandlerService) workbenchWindow 41 .getService(IHandlerService.class); 42 try { 43 handlerService.executeCommand(getActionDefinitionId(), 44 null); 45 } catch (Exception e) { 46 WorkbenchPlugin.log(e); 47 } 48 } 49 50 55 public void dispose() { 56 workbenchWindow = null; 57 } 58 } 59 | Popular Tags |