Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcanderson2010-04-14 22:11:53 +0000
committercanderson2010-04-14 22:11:53 +0000
commit0ad4509eb16011e45be51ac6dd24723b4e4abc3e (patch)
tree3431dd2e74efa16f5810a3bbb130fa4fbb4456f8 /plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet
parent537b1b88bd28f71a7975600336a15d88f6e2aae0 (diff)
downloadwebtools.javaee-0ad4509eb16011e45be51ac6dd24723b4e4abc3e.tar.gz
webtools.javaee-0ad4509eb16011e45be51ac6dd24723b4e4abc3e.tar.xz
webtools.javaee-0ad4509eb16011e45be51ac6dd24723b4e4abc3e.zip
[309204] Default java facet is inconsistent between web projects vs other projects
Diffstat (limited to 'plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet')
-rw-r--r--plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebFragmentProjectFirstPage.java29
-rw-r--r--plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebProjectFirstPage.java42
2 files changed, 54 insertions, 17 deletions
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebFragmentProjectFirstPage.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebFragmentProjectFirstPage.java
index 9dee1b755..1b86aa5e2 100644
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebFragmentProjectFirstPage.java
+++ b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebFragmentProjectFirstPage.java
@@ -13,18 +13,26 @@ package org.eclipse.jst.servlet.ui.project.facet;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
+import org.eclipse.jst.common.project.facet.JavaFacetUtils;
import org.eclipse.jst.j2ee.internal.wizard.J2EEComponentFacetCreationWizardPage;
import org.eclipse.jst.j2ee.web.project.facet.IWebFragmentProjectCreationDataModelProperties;
+import org.eclipse.jst.j2ee.web.project.facet.WebFacetUtils;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy;
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;
public class WebFragmentProjectFirstPage extends J2EEComponentFacetCreationWizardPage {
@@ -80,5 +88,24 @@ public class WebFragmentProjectFirstPage extends J2EEComponentFacetCreationWizar
protected String getModuleFacetID() {
return IModuleConstants.JST_WEBFRAGMENT_MODULE;
}
-
+
+ @Override
+ protected Set<IProjectFacetVersion> getFacetConfiguration( final IProjectFacetVersion primaryFacetVersion )
+ {
+ IRuntime runtime = (IRuntime)model.getProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME);
+ final Set<IProjectFacetVersion> facets = new HashSet<IProjectFacetVersion>( 2 );
+
+ if(runtime != null) {
+ facets.addAll(super.getFacetConfiguration(primaryFacetVersion));
+ }
+ else {
+ facets.add(primaryFacetVersion);
+
+ if(primaryFacetVersion == WebFacetUtils.WEBFRAGMENT_30)
+ {
+ facets.add(JavaFacetUtils.JAVA_60);
+ }
+ }
+ return Collections.unmodifiableSet( facets );
+ }
}
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebProjectFirstPage.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebProjectFirstPage.java
index 70035479f..fe4506f5c 100644
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebProjectFirstPage.java
+++ b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/project/facet/WebProjectFirstPage.java
@@ -23,8 +23,10 @@ import org.eclipse.jst.j2ee.internal.wizard.J2EEComponentFacetCreationWizardPage
import org.eclipse.jst.j2ee.web.project.facet.WebFacetUtils;
import org.eclipse.jst.servlet.ui.IWebUIContextIds;
import org.eclipse.jst.servlet.ui.internal.plugin.WEBUIMessages;
+import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
public class WebProjectFirstPage extends J2EEComponentFacetCreationWizardPage {
@@ -44,26 +46,34 @@ public class WebProjectFirstPage extends J2EEComponentFacetCreationWizardPage {
@Override
protected Set<IProjectFacetVersion> getFacetConfiguration( final IProjectFacetVersion primaryFacetVersion )
{
+ IRuntime runtime = (IRuntime)model.getProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME);
final Set<IProjectFacetVersion> facets = new HashSet<IProjectFacetVersion>( 2 );
- facets.add( primaryFacetVersion );
-
- if( primaryFacetVersion == WebFacetUtils.WEB_30 ||
- primaryFacetVersion == WebFacetUtils.WEB_25 )
- {
- facets.add( JavaFacetUtils.JAVA_50 );
- }
- else if( primaryFacetVersion == WebFacetUtils.WEB_24 )
- {
- facets.add( JavaFacetUtils.JAVA_14 );
+ if(runtime != null) {
+ facets.addAll(super.getFacetConfiguration(primaryFacetVersion));
}
- else if( primaryFacetVersion == WebFacetUtils.WEB_23 ||
- primaryFacetVersion == WebFacetUtils.WEB_22 )
- {
- facets.add( JavaFacetUtils.JAVA_13 );
+ else {
+ facets.add( primaryFacetVersion );
+
+ if( primaryFacetVersion == WebFacetUtils.WEB_30)
+ {
+ facets.add( JavaFacetUtils.JAVA_60 );
+ }
+ else if(primaryFacetVersion == WebFacetUtils.WEB_25 )
+ {
+ facets.add( JavaFacetUtils.JAVA_50 );
+ }
+ else if( primaryFacetVersion == WebFacetUtils.WEB_24 )
+ {
+ facets.add( JavaFacetUtils.JAVA_14 );
+ }
+ else if( primaryFacetVersion == WebFacetUtils.WEB_23 ||
+ primaryFacetVersion == WebFacetUtils.WEB_22 )
+ {
+ facets.add( JavaFacetUtils.JAVA_13 );
+ }
}
-
- return Collections.unmodifiableSet( facets );
+ return Collections.unmodifiableSet( facets );
}
}

Back to the top