01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.internal.ui.wizards.plugin;
11:
12: import java.util.Hashtable;
13:
14: import org.eclipse.jface.action.Action;
15: import org.eclipse.jface.viewers.StructuredSelection;
16: import org.eclipse.jface.window.Window;
17: import org.eclipse.jface.wizard.WizardDialog;
18: import org.eclipse.pde.internal.ui.PDEPlugin;
19: import org.eclipse.pde.internal.ui.util.SWTUtil;
20: import org.eclipse.ui.PlatformUI;
21: import org.eclipse.ui.cheatsheets.ICheatSheetAction;
22: import org.eclipse.ui.cheatsheets.ICheatSheetManager;
23:
24: public class OpenProjectWizardAction extends Action implements
25: 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[] {}, 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[] params, ICheatSheetManager manager) {
44: Hashtable defValues = new Hashtable();
45: if (params.length > 0)
46: defValues.put(NewPluginProjectWizard.DEF_PROJECT_NAME,
47: params[0]);
48: if (params.length > 1)
49: defValues.put(NewPluginProjectWizard.DEF_TEMPLATE_ID,
50: params[1]);
51: NewPluginProjectWizard wizard = new NewPluginProjectWizard();
52: wizard.init(PlatformUI.getWorkbench(),
53: new StructuredSelection());
54: wizard.init(defValues);
55: WizardDialog dialog = new WizardDialog(PDEPlugin
56: .getActiveWorkbenchShell(), wizard);
57: dialog.create();
58: SWTUtil.setDialogSize(dialog, 500, 500);
59: dialog.getShell().setText(wizard.getWindowTitle());
60: int result = dialog.open();
61: notifyResult(result == Window.OK);
62: }
63: }
|