1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
/*******************************************************************************
* Copyright (c) 2003, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.pde.internal.ui.wizards.feature;
import java.util.Hashtable;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.pde.internal.ui.PDEPlugin;
import org.eclipse.pde.internal.ui.PDEUIMessages;
import org.eclipse.pde.internal.ui.util.SWTUtil;
import org.eclipse.ui.IActionDelegate;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.cheatsheets.ICheatSheetAction;
import org.eclipse.ui.cheatsheets.ICheatSheetManager;
public class OpenProjectWizardAction extends Action implements ICheatSheetAction {
/**
* @param text
*/
public OpenProjectWizardAction() {
super(PDEUIMessages.Actions_Feature_OpenProjectWizardAction);
}
/**
* @see IActionDelegate#run(IAction)
*/
public void run() {
run(new String[] {}, null);
}
/* (non-Javadoc)
* @see org.eclipse.ui.cheatsheets.ICheatSheetAction#run(java.lang.String[], org.eclipse.ui.cheatsheets.ICheatSheetManager)
*/
public void run(String[] params, ICheatSheetManager manager) {
Hashtable<String, String> defValues = new Hashtable<String, String>();
if (params.length > 0)
defValues.put(AbstractNewFeatureWizard.DEF_PROJECT_NAME, params[0]);
if (params.length > 1)
defValues.put(AbstractNewFeatureWizard.DEF_FEATURE_ID, params[1]);
if (params.length > 2)
defValues.put(AbstractNewFeatureWizard.DEF_FEATURE_NAME, params[2]);
NewFeatureProjectWizard wizard = new NewFeatureProjectWizard();
wizard.init(defValues);
wizard.init(PlatformUI.getWorkbench(), new StructuredSelection());
WizardDialog dialog = new WizardDialog(PDEPlugin.getActiveWorkbenchShell(), wizard);
dialog.create();
SWTUtil.setDialogSize(dialog, 500, 500);
dialog.getShell().setText(wizard.getWindowTitle());
int result = dialog.open();
notifyResult(result == Window.OK);
}
}
|