1 /******************************************************************************* 2 * Copyright (c) 2005, 2015 IBM Corporation and others. 3 * 4 * This program and the accompanying materials 5 * are made available under the terms of the Eclipse Public License 2.0 6 * which accompanies this distribution, and is available at 7 * https://www.eclipse.org/legal/epl-2.0/ 8 * 9 * SPDX-License-Identifier: EPL-2.0 10 * 11 * Contributors: 12 * IBM Corporation - initial API and implementation 13 *******************************************************************************/ 14 package org.eclipse.pde.internal.ui.wizards.product; 15 16 import org.eclipse.jface.action.Action; 17 import org.eclipse.jface.action.IAction; 18 import org.eclipse.jface.viewers.StructuredSelection; 19 import org.eclipse.jface.window.Window; 20 import org.eclipse.jface.wizard.WizardDialog; 21 import org.eclipse.pde.internal.ui.PDEPlugin; 22 import org.eclipse.pde.internal.ui.util.SWTUtil; 23 import org.eclipse.ui.IActionDelegate; 24 import org.eclipse.ui.PlatformUI; 25 import org.eclipse.ui.cheatsheets.ICheatSheetAction; 26 import org.eclipse.ui.cheatsheets.ICheatSheetManager; 27 28 public class NewProductFileAction extends Action implements ICheatSheetAction { 29 NewProductFileAction()30 public NewProductFileAction() { 31 super("NewProductFile"); //$NON-NLS-1$ 32 } 33 34 /** 35 * @see IActionDelegate#run(IAction) 36 */ 37 @Override run()38 public void run() { 39 run(new String[] {}, null); 40 } 41 42 @Override run(String[] params, ICheatSheetManager manager)43 public void run(String[] params, ICheatSheetManager manager) { 44 NewProductFileWizard wizard = new NewProductFileWizard(); 45 wizard.init(PlatformUI.getWorkbench(), new StructuredSelection()); 46 WizardDialog dialog = new WizardDialog(PDEPlugin.getActiveWorkbenchShell(), wizard); 47 dialog.create(); 48 SWTUtil.setDialogSize(dialog, 500, 500); 49 dialog.getShell().setText(wizard.getWindowTitle()); 50 int result = dialog.open(); 51 notifyResult(result == Window.OK); 52 } 53 54 } 55