KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2000, 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.plugin;
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.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     /**
27      * @param text
28      */

29     public OpenProjectWizardAction() {
30         super("OpenProject"); //$NON-NLS-1$
31
}
32     
33     /**
34      * @see IActionDelegate#run(IAction)
35      */

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

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