KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > ui > actions > OpenNewJavaProjectWizardAction


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
12 package org.eclipse.jdt.ui.actions;
13
14 import org.eclipse.core.runtime.CoreException;
15
16 import org.eclipse.swt.widgets.Shell;
17
18 import org.eclipse.jface.viewers.IStructuredSelection;
19
20 import org.eclipse.ui.INewWizard;
21 import org.eclipse.ui.PlatformUI;
22
23 import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
24 import org.eclipse.jdt.internal.ui.JavaPlugin;
25 import org.eclipse.jdt.internal.ui.JavaPluginImages;
26 import org.eclipse.jdt.internal.ui.actions.ActionMessages;
27 import org.eclipse.jdt.internal.ui.wizards.JavaProjectWizard;
28
29 /**
30  * <p>Action that opens the new Java project wizard. The action initializes the wizard with the
31  * selection as configured by {@link #setSelection(IStructuredSelection)} or the selection of
32  * the active workbench window.</p>
33  *
34  * <p>
35  * This class may be instantiated; it is not intended to be subclassed.
36  * </p>
37  *
38  * @since 3.2
39  */

40 public class OpenNewJavaProjectWizardAction extends AbstractOpenWizardAction {
41     
42     /**
43      * Creates an instance of the <code>OpenNewJavaProjectWizardAction</code>.
44      */

45     public OpenNewJavaProjectWizardAction() {
46         setText(ActionMessages.OpenNewJavaProjectWizardAction_text);
47         setDescription(ActionMessages.OpenNewJavaProjectWizardAction_description);
48         setToolTipText(ActionMessages.OpenNewJavaProjectWizardAction_tooltip);
49         setImageDescriptor(JavaPluginImages.DESC_WIZBAN_NEWJPRJ);
50         PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.OPEN_PROJECT_WIZARD_ACTION);
51         setShell(JavaPlugin.getActiveWorkbenchShell());
52     }
53     
54     /* (non-Javadoc)
55      * @see org.eclipse.jdt.ui.actions.AbstractOpenWizardAction#createWizard()
56      */

57     protected final INewWizard createWizard() throws CoreException {
58         return new JavaProjectWizard();
59     }
60     
61     /* (non-Javadoc)
62      * @see org.eclipse.jdt.ui.actions.AbstractOpenWizardAction#doCreateProjectFirstOnEmptyWorkspace(Shell)
63      */

64     protected boolean doCreateProjectFirstOnEmptyWorkspace(Shell shell) {
65         return true; // can work on an empty workspace
66
}
67 }
68
Popular Tags