1 11 package org.eclipse.pde.internal.ui.wizards.feature; 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.PDEUIMessages; 21 import org.eclipse.pde.internal.ui.util.SWTUtil; 22 import org.eclipse.ui.PlatformUI; 23 import org.eclipse.ui.cheatsheets.ICheatSheetAction; 24 import org.eclipse.ui.cheatsheets.ICheatSheetManager; 25 26 public class OpenProjectWizardAction extends Action implements ICheatSheetAction { 27 30 public OpenProjectWizardAction() { 31 super(PDEUIMessages.Actions_Feature_OpenProjectWizardAction); 32 } 33 34 37 public void run() { 38 run(new String [] {}, null); 39 } 40 41 44 public void run(String [] params, ICheatSheetManager manager) { 45 Hashtable defValues = new Hashtable (); 46 if (params.length>0) 47 defValues.put(AbstractNewFeatureWizard.DEF_PROJECT_NAME, params[0]); 48 if (params.length>1) 49 defValues.put(AbstractNewFeatureWizard.DEF_FEATURE_ID, params[1]); 50 if (params.length>2) 51 defValues.put(AbstractNewFeatureWizard.DEF_FEATURE_NAME, params[2]); 52 NewFeatureProjectWizard wizard = new NewFeatureProjectWizard(); 53 wizard.init(defValues); 54 wizard.init(PlatformUI.getWorkbench(), new StructuredSelection()); 55 WizardDialog dialog = new WizardDialog(PDEPlugin.getActiveWorkbenchShell(), wizard); 56 dialog.create(); 57 SWTUtil.setDialogSize(dialog, 500, 500); 58 dialog.getShell().setText(wizard.getWindowTitle()); 59 int result = dialog.open(); 60 notifyResult(result == Window.OK); 61 } 62 } 63 | Popular Tags |