Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpelder2008-05-01 11:20:02 -0400
committerpelder2008-05-01 11:20:02 -0400
commit21a12ef56bfd30e6e7d2ad6dd6cf3883917516c9 (patch)
tree5095007dedbf1ca7b9139512c4e2810deda6d97c
parent946d8df82bd41232df08f1a855be4b56d20cc15e (diff)
downloadorg.eclipse.jet-21a12ef56bfd30e6e7d2ad6dd6cf3883917516c9.tar.gz
org.eclipse.jet-21a12ef56bfd30e6e7d2ad6dd6cf3883917516c9.tar.xz
org.eclipse.jet-21a12ef56bfd30e6e7d2ad6dd6cf3883917516c9.zip
[229775] New JET projects should specify execution environment
-rw-r--r--plugins/org.eclipse.jet.ui/META-INF/MANIFEST.MF4
-rw-r--r--plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/NewProjectWizard.java28
-rw-r--r--plugins/org.eclipse.jet/transforms/plugins/org.eclipse.jet.transforms.newproject_1.0.0.jarbin35833 -> 37537 bytes
-rw-r--r--transforms/org.eclipse.jet.transforms.newproject/templates/project/classpath.jet9
-rw-r--r--transforms/org.eclipse.jet.transforms.newproject/templates/project/manifest.mf.jet3
-rw-r--r--transforms/org.eclipse.jet.transforms.newproject/templates/project/org.eclipse.jet.prefs.jet3
6 files changed, 45 insertions, 2 deletions
diff --git a/plugins/org.eclipse.jet.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.jet.ui/META-INF/MANIFEST.MF
index 249e91a..663d1b7 100644
--- a/plugins/org.eclipse.jet.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.jet.ui/META-INF/MANIFEST.MF
@@ -13,7 +13,8 @@ Require-Bundle: org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
org.eclipse.debug.core;bundle-version="[3.2.0,4.0.0)",
org.eclipse.ui;bundle-version="[3.2.0,4.0.0)",
org.eclipse.ui.ide;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.jdt.core;bundle-version="[3.2.0,4.0.0)"
+ org.eclipse.jdt.core;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.jdt.launching;bundle-version="[3.2.0,4.0.0)"
Eclipse-LazyStart: true
Export-Package: org.eclipse.jet.internal.ui.filters;x-internal:=true,
org.eclipse.jet.internal.ui.l10n;x-internal:=true,
@@ -23,3 +24,4 @@ Export-Package: org.eclipse.jet.internal.ui.filters;x-internal:=true,
org.eclipse.jet.ui,
org.eclipse.jet.ui.newproject
Bundle-RequiredExecutionEnvironment: J2SE-1.4
+Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/NewProjectWizard.java b/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/NewProjectWizard.java
index b825b92..dbcec51 100644
--- a/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/NewProjectWizard.java
+++ b/plugins/org.eclipse.jet.ui/src/org/eclipse/jet/ui/newproject/NewProjectWizard.java
@@ -17,9 +17,13 @@
package org.eclipse.jet.ui.newproject;
import java.lang.reflect.InvocationTargetException;
+import java.util.Arrays;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jdt.launching.environments.IExecutionEnvironment;
import org.eclipse.jet.JET2Platform;
import org.eclipse.jet.internal.InternalJET2Platform;
import org.eclipse.jet.internal.ui.l10n.Messages;
@@ -92,6 +96,11 @@ public class NewProjectWizard extends Wizard implements INewWizard {
newProjectInfo.setProjectAttribute("dfltJavaPackage", projectPage.getDefaultJavaPackage()); //$NON-NLS-1$
newProjectInfo.setProjectAttribute("description", projectPropertiesPage.getTransformDescription()); //$NON-NLS-1$
newProjectInfo.setProjectAttribute("templateLoader", projectPropertiesPage.getTemplateLoader()); //$NON-NLS-1$
+ final String defaultEE = getDefaultExecutionEnv();
+ if(defaultEE != null) {
+ newProjectInfo.setProjectAttribute("executionEnv", defaultEE); //$NON-NLS-1$
+ newProjectInfo.setProjectAttribute("useJava5", Boolean.toString(isDefaultEEJava5Compatible())); //$NON-NLS-1$
+ }
if(projectPropertiesPage.isExtension()) {
newProjectInfo.setProjectAttribute("baseID", projectPropertiesPage.getBaseTransformID()); //$NON-NLS-1$
final IJETBundleDescriptor descriptor = JET2Platform.getJETBundleManager().getDescriptor(projectPropertiesPage.getBaseTransformID());
@@ -103,6 +112,25 @@ public class NewProjectWizard extends Wizard implements INewWizard {
return newProjectInfo.toXmlString();
}
+ private boolean isDefaultEEJava5Compatible() {
+
+ final IVMInstall defaultVMInstall = JavaRuntime.getDefaultVMInstall();
+ final IExecutionEnvironment java5ee = JavaRuntime.getExecutionEnvironmentsManager().getEnvironment("J2SE-1.5"); //$NON-NLS-1$
+ return Arrays.asList(java5ee.getCompatibleVMs()).contains(defaultVMInstall);
+ }
+
+ private String getDefaultExecutionEnv() {
+ final IVMInstall defaultVMInstall = JavaRuntime.getDefaultVMInstall();
+ final IExecutionEnvironment[] ee = JavaRuntime.getExecutionEnvironmentsManager().getExecutionEnvironments();
+ for (int i = 0; i < ee.length; i++) {
+ if(ee[i].isStrictlyCompatible(defaultVMInstall)) {
+ return ee[i].getId();
+ }
+ }
+
+ return null;
+ }
+
/* (non-Javadoc)
* @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
*/
diff --git a/plugins/org.eclipse.jet/transforms/plugins/org.eclipse.jet.transforms.newproject_1.0.0.jar b/plugins/org.eclipse.jet/transforms/plugins/org.eclipse.jet.transforms.newproject_1.0.0.jar
index 403bf8c..f5214c0 100644
--- a/plugins/org.eclipse.jet/transforms/plugins/org.eclipse.jet.transforms.newproject_1.0.0.jar
+++ b/plugins/org.eclipse.jet/transforms/plugins/org.eclipse.jet.transforms.newproject_1.0.0.jar
Binary files differ
diff --git a/transforms/org.eclipse.jet.transforms.newproject/templates/project/classpath.jet b/transforms/org.eclipse.jet.transforms.newproject/templates/project/classpath.jet
index a973d74..5960c50 100644
--- a/transforms/org.eclipse.jet.transforms.newproject/templates/project/classpath.jet
+++ b/transforms/org.eclipse.jet.transforms.newproject/templates/project/classpath.jet
@@ -2,7 +2,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="<c:get select="$project/@jet2javaDir" default="jet2java" />"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+<c:choose>
+ <c:when test="$project/@executionEnv">
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/<c:get select="$project/@executionEnv"/>"/>
+ </c:when>
+ <c:otherwise>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ </c:otherwise>
+</c:choose>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="<c:get select="$project/@binDir" />"/>
</classpath>
diff --git a/transforms/org.eclipse.jet.transforms.newproject/templates/project/manifest.mf.jet b/transforms/org.eclipse.jet.transforms.newproject/templates/project/manifest.mf.jet
index 6a92ebe..bd0f8e8 100644
--- a/transforms/org.eclipse.jet.transforms.newproject/templates/project/manifest.mf.jet
+++ b/transforms/org.eclipse.jet.transforms.newproject/templates/project/manifest.mf.jet
@@ -7,3 +7,6 @@ Bundle-Version: <c:get select="$project/@bundleVersion"/>
Bundle-Vendor:
Require-Bundle: org.eclipse.jet
Bundle-ClassPath: .,<c:get select="$project/@binDir"/>/
+<c:if test="$project/@executionEnv">
+Bundle-RequiredExecutionEnvironment: <c:get select="$project/@executionEnv"/>
+</c:if> \ No newline at end of file
diff --git a/transforms/org.eclipse.jet.transforms.newproject/templates/project/org.eclipse.jet.prefs.jet b/transforms/org.eclipse.jet.transforms.newproject/templates/project/org.eclipse.jet.prefs.jet
index df36efb..ba3dc31 100644
--- a/transforms/org.eclipse.jet.transforms.newproject/templates/project/org.eclipse.jet.prefs.jet
+++ b/transforms/org.eclipse.jet.transforms.newproject/templates/project/org.eclipse.jet.prefs.jet
@@ -3,3 +3,6 @@ eclipse.preferences.version=1
org.eclipse.jet.compiledTemplatePackage=<c:get select="propertiesEncode($project/@dfltJavaPackage, true())"/>
org.eclipse.jet.compiledTemplateSrcDir=<c:get select="propertiesEncode($project/@jet2javaDir, true())"/>
org.eclipse.jet.projectPrefs=true
+<c:if test="$project/@useJava5">
+org.eclipse.jet.useJava5=<c:get select="$project/@useJava5"/>
+</c:if>

Back to the top