1 11 package org.eclipse.ui.internal; 12 13 import org.eclipse.jface.action.Action; 14 import org.eclipse.ui.IWorkbenchWindow; 15 import org.eclipse.ui.PlatformUI; 16 import org.eclipse.ui.actions.ActionFactory; 17 18 21 public class QuitAction extends Action implements 22 ActionFactory.IWorkbenchAction { 23 24 28 private IWorkbenchWindow workbenchWindow; 29 30 35 public QuitAction(IWorkbenchWindow window) { 36 if (window == null) { 39 throw new IllegalArgumentException (); 40 } 41 this.workbenchWindow = window; 42 setText(WorkbenchMessages.Exit_text); 43 setToolTipText(WorkbenchMessages.Exit_toolTip); 44 setActionDefinitionId("org.eclipse.ui.file.exit"); window.getWorkbench().getHelpSystem().setHelp(this, 46 IWorkbenchHelpContextIds.QUIT_ACTION); 47 } 48 49 52 public void run() { 53 if (workbenchWindow == null) { 54 return; 56 } 57 PlatformUI.getWorkbench().close(); 58 } 59 60 63 public void dispose() { 64 workbenchWindow = null; 65 } 66 67 } 68 | Popular Tags |