KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > wizards > site > 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.site;
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_Site_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(NewSiteProjectWizard.DEF_PROJECT_NAME, params[0]);
48         NewSiteProjectWizard wizard = new NewSiteProjectWizard();
49         wizard.init(PlatformUI.getWorkbench(), new StructuredSelection());
50         wizard.init(defValues);
51         WizardDialog dialog = new WizardDialog(PDEPlugin.getActiveWorkbenchShell(), wizard);
52         dialog.create();
53         SWTUtil.setDialogSize(dialog, 500, 500);
54         dialog.getShell().setText(wizard.getWindowTitle());
55         int result = dialog.open();
56         notifyResult(result==Window.OK);
57     }
58 }
59
Popular Tags