1 11 package org.eclipse.ui.internal.about; 12 13 import org.eclipse.core.runtime.IProduct; 14 import org.eclipse.core.runtime.Platform; 15 import org.eclipse.jface.action.Action; 16 import org.eclipse.osgi.util.NLS; 17 import org.eclipse.ui.IWorkbenchWindow; 18 import org.eclipse.ui.actions.ActionFactory; 19 import org.eclipse.ui.internal.IWorkbenchHelpContextIds; 20 import org.eclipse.ui.internal.WorkbenchMessages; 21 import org.eclipse.ui.internal.dialogs.AboutDialog; 22 23 26 public class AboutAction extends Action implements 27 ActionFactory.IWorkbenchAction { 28 29 33 private IWorkbenchWindow workbenchWindow; 34 35 40 public AboutAction(IWorkbenchWindow window) { 41 if (window == null) { 42 throw new IllegalArgumentException (); 43 } 44 45 this.workbenchWindow = window; 46 47 IProduct product = Platform.getProduct(); 49 String productName = null; 50 if (product != null) { 51 productName = product.getName(); 52 } 53 if (productName == null) { 54 productName = ""; } 56 setText(NLS.bind(WorkbenchMessages.AboutAction_text,productName)); 57 setToolTipText(NLS.bind(WorkbenchMessages.AboutAction_toolTip, productName)); 58 setId("about"); setActionDefinitionId("org.eclipse.ui.help.aboutAction"); window.getWorkbench().getHelpSystem().setHelp(this, 61 IWorkbenchHelpContextIds.ABOUT_ACTION); 62 } 63 64 67 public void run() { 68 if (workbenchWindow != null) { 70 new AboutDialog(workbenchWindow.getShell()).open(); 71 } 72 } 73 74 77 public void dispose() { 78 workbenchWindow = null; 79 } 80 } 81 | Popular Tags |