Author: akazakov
Date: 2011-11-02 20:47:54 -0400 (Wed, 02 Nov 2011)
New Revision: 36150
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/CDIProjectWizard.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/plugin.xml
trunk/cdi/plugins/org.jboss.tools.cdi.ui/META-INF/MANIFEST.MF
trunk/cdi/plugins/org.jboss.tools.cdi.ui/plugin.xml
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties
Log:
https://issues.jboss.org/browse/JBIDE-9581 Create vanilla CDI getting started project
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/plugin.xml
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/plugin.xml 2011-11-02 23:50:22 UTC (rev
36149)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/plugin.xml 2011-11-03 00:47:54 UTC (rev
36150)
@@ -67,6 +67,21 @@
</or>
</constraint>
</project-facet-version>
+
+ <template
+ id="template.jboss.tools.cdi10">
+ <label>
+ CDI Web Project
+ </label>
+ <fixed
+ facet="jst.java"/>
+ <fixed
+ facet="jst.web"/>
+ <preset
+ id="jboss.jst.cdi.preset">
+ </preset>
+ </template>
+
<action
facet="jst.cdi"
id="jst.cdi.1.0.install"
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/META-INF/MANIFEST.MF 2011-11-02 23:50:22 UTC
(rev 36149)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/META-INF/MANIFEST.MF 2011-11-03 00:47:54 UTC
(rev 36150)
@@ -35,7 +35,9 @@
org.eclipse.ui.navigator;bundle-version="3.5.0",
org.eclipse.ui.navigator.resources;bundle-version="3.4.300",
org.eclipse.draw2d;bundle-version="3.7.0",
- org.eclipse.jdt.core.manipulation;bundle-version="1.4.0"
+ org.eclipse.jdt.core.manipulation;bundle-version="1.4.0",
+ org.eclipse.jst.servlet.ui;bundle-version="1.1.500",
+ org.eclipse.wst.web.ui;bundle-version="1.1.400"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: %Bundle-Vendor.0
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/plugin.xml
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/plugin.xml 2011-11-02 23:50:22 UTC (rev
36149)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/plugin.xml 2011-11-03 00:47:54 UTC (rev
36150)
@@ -180,6 +180,21 @@
name="CDI (Context and Dependency Injection)"
id="org.jboss.tools.cdi.ui">
</category>
+ <wizard
+ category="org.jboss.tools.cdi.ui"
+ class="org.jboss.tools.cdi.ui.wizard.CDIProjectWizard"
+ icon="platform:/plugin/org.jboss.tools.cdi.core/images/cdi16.png"
+ id="org.jboss.tools.cdi.ui.wizard.NewCDIProjectWizard"
+ name="CDI Web Project"
+
preferredPerspectives="org.eclipse.jst.j2ee.J2EEPerspective,org.jboss.tools.jst.web.ui.WebDevelopmentPerspective"
+ project="true">
+ <description>
+ Create a CDI Web Project
+ </description>
+ <selection
+ class="org.eclipse.core.resources.IResource">
+ </selection>
+ </wizard>
<wizard
category="org.jboss.tools.cdi.ui"
class="org.jboss.tools.cdi.ui.wizard.NewQualifierCreationWizard"
@@ -344,6 +359,9 @@
<perspectiveExtension
targetID="org.eclipse.jst.j2ee.J2EEPerspective">
<newWizardShortcut
+ id="org.jboss.tools.cdi.ui.wizard.NewCDIProjectWizard">
+ </newWizardShortcut>
+ <newWizardShortcut
id="org.jboss.tools.cdi.ui.wizard.NewBeanCreationWizard">
</newWizardShortcut>
<newWizardShortcut
@@ -388,6 +406,20 @@
<commonWizard
menuGroupId="org.jboss.tools.cdi.ui"
type="new"
+ wizardId="org.jboss.tools.cdi.ui.wizard.NewCDIProjectWizard">
+ <enablement>
+ <or>
+ <adapt type="org.eclipse.core.resources.IFile" />
+ <adapt type="org.eclipse.core.resources.IFolder" />
+ <adapt type="org.eclipse.core.resources.IProject" />
+ <adapt type="org.eclipse.core.resources.IWorkspaceRoot"
/>
+ <adapt type="org.eclipse.jdt.core.IJavaElement" />
+ </or>
+ </enablement>
+ </commonWizard>
+ <commonWizard
+ menuGroupId="org.jboss.tools.cdi.ui"
+ type="new"
wizardId="org.jboss.tools.cdi.ui.wizard.NewBeanCreationWizard">
<enablement>
<or>
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java 2011-11-02
23:50:22 UTC (rev 36149)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java 2011-11-03
00:47:54 UTC (rev 36150)
@@ -15,7 +15,7 @@
public class CDIUIMessages extends NLS{
private static final String BUNDLE_NAME =
"org.jboss.tools.cdi.ui.CDIUIMessages"; //$NON-NLS-1$
-
+
static {
NLS.initializeMessages(BUNDLE_NAME, CDIUIMessages.class);
}
@@ -152,4 +152,6 @@
public static String OPEN_CDI_NAMED_BEAN_ACTION_NAME;
public static String OPEN_CDI_NAMED_BEAN_ACTION_MESSAGE;
-}
+
+ public static String CDI_PROJECT_WIZARD_NEW_PROJECT;
+}
\ No newline at end of file
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties 2011-11-02
23:50:22 UTC (rev 36149)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties 2011-11-03
00:47:54 UTC (rev 36150)
@@ -141,4 +141,4 @@
OPEN_CDI_NAMED_BEAN_ACTION_NAME=Open CDI Named Bean
OPEN_CDI_NAMED_BEAN_ACTION_MESSAGE=Enter bean EL name prefix or pattern (? = any
character, * = any string):
-
+CDI_PROJECT_WIZARD_NEW_PROJECT=New CDI Web Project
\ No newline at end of file
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/CDIProjectWizard.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/CDIProjectWizard.java
(rev 0)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/CDIProjectWizard.java 2011-11-03
00:47:54 UTC (rev 36150)
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.ui.wizard;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jst.servlet.ui.project.facet.WebProjectWizard;
+import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
+import org.eclipse.wst.common.project.facet.core.IFacetedProjectTemplate;
+import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy;
+import org.eclipse.wst.common.project.facet.core.IPreset;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
+import org.jboss.tools.cdi.ui.CDIUIMessages;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class CDIProjectWizard extends WebProjectWizard {
+
+ private static final String CDI_TEMPALTE = "template.jboss.tools.cdi10";
+ private IPreset oldPreset;
+
+ public CDIProjectWizard() {
+ super();
+ setWindowTitle(CDIUIMessages.CDI_PROJECT_WIZARD_NEW_PROJECT);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jst.servlet.ui.project.facet.WebProjectWizard#getTemplate()
+ */
+ @Override
+ protected IFacetedProjectTemplate getTemplate() {
+ return ProjectFacetsManager.getTemplate(CDI_TEMPALTE);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
org.eclipse.wst.web.ui.internal.wizards.NewProjectDataModelFacetWizard#setRuntimeAndDefaultFacets(org.eclipse.wst.common.project.facet.core.runtime.IRuntime)
+ */
+ @Override
+ protected void setRuntimeAndDefaultFacets(IRuntime runtime) {
+ IPreset preset = getFacetedProjectWorkingCopy().getSelectedPreset();
+ if(preset!=null) {
+ oldPreset = preset;
+ }
+ IFacetedProjectWorkingCopy dm = getFacetedProjectWorkingCopy();
+ dm.setTargetedRuntimes(Collections.<IRuntime> emptySet());
+ boolean dontUseRuntimeConfig = false;
+ if (runtime != null) {
+ if(oldPreset!=null) {
+ dm.setProjectFacets(oldPreset.getProjectFacets());
+ dontUseRuntimeConfig = true;
+ } else {
+ Set<IProjectFacetVersion> minFacets = new
HashSet<IProjectFacetVersion>();
+ try {
+ for (IProjectFacet f : dm.getFixedProjectFacets()) {
+ minFacets.add(f.getLatestSupportedVersion(runtime));
+ }
+ } catch (CoreException e) {
+ throw new RuntimeException(e);
+ }
+ dm.setProjectFacets(minFacets);
+ }
+ dm.setTargetedRuntimes(Collections.singleton(runtime));
+ }
+ if(dontUseRuntimeConfig) {
+ if(dm.getAvailablePresets().contains(oldPreset)) {
+ dm.setSelectedPreset(oldPreset.getId());
+ }
+ } else
if(dm.getAvailablePresets().contains(FacetedProjectFramework.DEFAULT_CONFIGURATION_PRESET_ID))
{
+ dm.setSelectedPreset(FacetedProjectFramework.DEFAULT_CONFIGURATION_PRESET_ID);
+ }
+ }
+}
\ No newline at end of file
Property changes on:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/CDIProjectWizard.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain