01: /*******************************************************************************
02: * Copyright (c) 2003, 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.site;
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.PDEUIMessages;
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
26: ICheatSheetAction {
27: /**
28: * @param text
29: */
30: public OpenProjectWizardAction() {
31: super (PDEUIMessages.Actions_Site_OpenProjectWizardAction);
32: }
33:
34: /**
35: * @see IActionDelegate#run(IAction)
36: */
37: public void run() {
38: run(new String[] {}, 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[] params, ICheatSheetManager manager) {
45: Hashtable defValues = new Hashtable();
46: if (params.length > 0)
47: defValues.put(NewSiteProjectWizard.DEF_PROJECT_NAME,
48: params[0]);
49: NewSiteProjectWizard wizard = new NewSiteProjectWizard();
50: wizard.init(PlatformUI.getWorkbench(),
51: new StructuredSelection());
52: wizard.init(defValues);
53: WizardDialog dialog = new WizardDialog(PDEPlugin
54: .getActiveWorkbenchShell(), wizard);
55: dialog.create();
56: SWTUtil.setDialogSize(dialog, 500, 500);
57: dialog.getShell().setText(wizard.getWindowTitle());
58: int result = dialog.open();
59: notifyResult(result == Window.OK);
60: }
61: }
|