1 11 package org.eclipse.ui.internal; 12 13 import org.eclipse.jface.action.Action; 14 import org.eclipse.ui.IWorkbenchPage; 15 import org.eclipse.ui.IWorkbenchWindow; 16 import org.eclipse.ui.actions.ActionFactory; 17 import org.eclipse.ui.internal.dialogs.WorkbenchEditorsDialog; 18 19 23 public class WorkbenchEditorsAction extends Action implements 24 ActionFactory.IWorkbenchAction { 25 26 30 private IWorkbenchWindow workbenchWindow; 31 32 37 public WorkbenchEditorsAction(IWorkbenchWindow window) { 38 super(WorkbenchMessages.WorkbenchEditorsAction_label); 39 if (window == null) { 40 throw new IllegalArgumentException (); 41 } 42 this.workbenchWindow = window; 43 workbenchWindow.getWorkbench().getHelpSystem().setHelp(this, 45 IWorkbenchHelpContextIds.WORKBENCH_EDITORS_ACTION); 46 setActionDefinitionId("org.eclipse.ui.window.switchToEditor"); } 48 49 52 public void run() { 53 if (workbenchWindow == null) { 54 return; 56 } 57 IWorkbenchPage page = workbenchWindow.getActivePage(); 58 if (page != null) { 59 new WorkbenchEditorsDialog(workbenchWindow).open(); 60 } 61 } 62 63 66 public void dispose() { 67 workbenchWindow = null; 68 } 69 } 70 | Popular Tags |