1 11 package org.eclipse.pde.internal.ui.wizards.plugin; 12 13 import java.util.Hashtable ; 14 15 import org.eclipse.jface.action.Action; 16 import org.eclipse.jface.viewers.StructuredSelection; 17 import org.eclipse.jface.window.Window; 18 import org.eclipse.jface.wizard.WizardDialog; 19 import org.eclipse.pde.internal.ui.PDEPlugin; 20 import org.eclipse.pde.internal.ui.util.SWTUtil; 21 import org.eclipse.ui.PlatformUI; 22 import org.eclipse.ui.cheatsheets.ICheatSheetAction; 23 import org.eclipse.ui.cheatsheets.ICheatSheetManager; 24 25 public class OpenProjectWizardAction extends Action implements ICheatSheetAction { 26 29 public OpenProjectWizardAction() { 30 super("OpenProject"); } 32 33 36 public void run() { 37 run(new String [] {}, null); 38 } 39 40 43 public void run(String [] params, ICheatSheetManager manager) { 44 Hashtable defValues = new Hashtable (); 45 if (params.length>0) 46 defValues.put(NewPluginProjectWizard.DEF_PROJECT_NAME, params[0]); 47 if (params.length>1) 48 defValues.put(NewPluginProjectWizard.DEF_TEMPLATE_ID, params[1]); 49 NewPluginProjectWizard wizard = new NewPluginProjectWizard(); 50 wizard.init(PlatformUI.getWorkbench(), new StructuredSelection()); 51 wizard.init(defValues); 52 WizardDialog dialog = new WizardDialog(PDEPlugin.getActiveWorkbenchShell(), wizard); 53 dialog.create(); 54 SWTUtil.setDialogSize(dialog, 500, 500); 55 dialog.getShell().setText(wizard.getWindowTitle()); 56 int result = dialog.open(); 57 notifyResult(result==Window.OK); 58 } 59 } 60 | Popular Tags |