KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > wizards > feature > OpenProjectWizardAction


1 /*******************************************************************************
2  * Copyright (c) 2003, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.pde.internal.ui.wizards.feature;
12
13 import java.util.Hashtable JavaDoc;
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     /**
28      * @param text
29      */

30     public OpenProjectWizardAction() {
31         super(PDEUIMessages.Actions_Feature_OpenProjectWizardAction);
32     }
33     
34     /**
35      * @see IActionDelegate#run(IAction)
36      */

37     public void run() {
38         run(new String JavaDoc [] {}, null);
39     }
40
41     /* (non-Javadoc)
42      * @see org.eclipse.ui.cheatsheets.ICheatSheetAction#run(java.lang.String[], org.eclipse.ui.cheatsheets.ICheatSheetManager)
43      */

44     public void run(String JavaDoc[] params, ICheatSheetManager manager) {
45         Hashtable JavaDoc defValues = new Hashtable JavaDoc();
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