You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2009/07/10 10:45:34 UTC

svn commit: r792835 - in /harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments: ./ .settings/ META-INF/ src/ src/org/ src/org/apache/ src/org/apache/harmony/ src/org/apache/harmony/eclipse/ src/org/apache/harmony/e...

Author: tellison
Date: Fri Jul 10 08:45:33 2009
New Revision: 792835

URL: http://svn.apache.org/viewvc?rev=792835&view=rev
Log:
Initial import of execution environment for Select

Added:
    harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/.classpath   (with props)
    harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/.project   (with props)
    harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/.settings/
    harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/.settings/org.eclipse.jdt.core.prefs
    harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/META-INF/
    harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/META-INF/MANIFEST.MF   (with props)
    harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/build.properties   (with props)
    harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/plugin.xml   (with props)
    harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/
    harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/Harmony-Select-1.0
    harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/
    harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/
    harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/
    harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/
    harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/
    harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/launching/
    harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/launching/environments/
    harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/launching/environments/AccessRuleParticipant.java   (with props)
    harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/launching/environments/Activator.java   (with props)
    harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/launching/environments/ExecutionEnvironmentAnalyzer.java   (with props)

Added: harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/.classpath
URL: http://svn.apache.org/viewvc/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/.classpath?rev=792835&view=auto
==============================================================================
--- harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/.classpath (added)
+++ harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/.classpath Fri Jul 10 08:45:33 2009
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

Propchange: harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/.classpath
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/.project
URL: http://svn.apache.org/viewvc/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/.project?rev=792835&view=auto
==============================================================================
--- harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/.project (added)
+++ harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/.project Fri Jul 10 08:45:33 2009
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.apache.harmony.eclipse.jdt.launching.environments</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Propchange: harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/.project
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/.settings/org.eclipse.jdt.core.prefs
URL: http://svn.apache.org/viewvc/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/.settings/org.eclipse.jdt.core.prefs?rev=792835&view=auto
==============================================================================
--- harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/.settings/org.eclipse.jdt.core.prefs (added)
+++ harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/.settings/org.eclipse.jdt.core.prefs Fri Jul 10 08:45:33 2009
@@ -0,0 +1,8 @@
+#Thu Jul 09 15:34:58 BST 2009
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5

Added: harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/META-INF/MANIFEST.MF?rev=792835&view=auto
==============================================================================
--- harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/META-INF/MANIFEST.MF (added)
+++ harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/META-INF/MANIFEST.MF Fri Jul 10 08:45:33 2009
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Harmony Environments
+Bundle-SymbolicName: org.apache.harmony.eclipse.jdt.launching.environments;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.apache.harmony.eclipse.jdt.launching.environments.Activator
+Bundle-Vendor: Apache Software Foundation
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.jdt.launching;bundle-version="3.5.100",
+ org.eclipse.jdt.core;bundle-version="3.5.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Eclipse-LazyStart: true
+Bundle-ActivationPolicy: lazy
+

Propchange: harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/META-INF/MANIFEST.MF
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/build.properties
URL: http://svn.apache.org/viewvc/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/build.properties?rev=792835&view=auto
==============================================================================
--- harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/build.properties (added)
+++ harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/build.properties Fri Jul 10 08:45:33 2009
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml

Propchange: harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/build.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/plugin.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/plugin.xml?rev=792835&view=auto
==============================================================================
--- harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/plugin.xml (added)
+++ harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/plugin.xml Fri Jul 10 08:45:33 2009
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+
+<plugin>
+   <extension
+       point="org.eclipse.jdt.launching.executionEnvironments">
+
+   <environment
+       description="Apache Harmony Select"
+       id="Harmony-Select-1.0"
+       ruleParticipant="org.apache.harmony.eclipse.jdt.launching.environments.AccessRuleParticipant"/>
+
+   <analyzer
+       class="org.apache.harmony.eclipse.jdt.launching.environments.ExecutionEnvironmentAnalyzer"
+       id="org.apache.harmony.eclipse.jdt.launching.environments.eeAnalyzer"/>
+
+   </extension>
+
+</plugin>

Propchange: harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/plugin.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/Harmony-Select-1.0
URL: http://svn.apache.org/viewvc/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/Harmony-Select-1.0?rev=792835&view=auto
==============================================================================
--- harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/Harmony-Select-1.0 (added)
+++ harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/Harmony-Select-1.0 Fri Jul 10 08:45:33 2009
@@ -0,0 +1,151 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+# 
+#     http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Harmony-Select-1.0 package definition
+
+#annotation
+java.lang.annotation
+
+#archive
+java.util.jar
+java.util.zip
+
+#auth
+javax.security.auth
+javax.security.auth.callback
+javax.security.auth.kerberos
+javax.security.auth.login
+javax.security.auth.spi
+javax.security.auth.x500
+javax.security.sasl
+org.ietf.jgss
+
+#beans
+java.beans
+java.beans.beancontext
+
+#concurrent
+java.util.concurrent
+java.util.concurrent.atomic
+java.util.concurrent.locks
+
+#crypto
+javax.crypto
+javax.crypto.interfaces
+javax.crypto.spec
+
+#instrument
+java.lang.instrument
+
+#jndi
+javax.naming
+javax.naming.directory
+javax.naming.event
+javax.naming.ldap
+javax.naming.spi
+
+#lang-mgmt
+java.lang.management
+
+#logging
+java.util.logging
+ 
+#luni
+java.io
+java.lang
+java.lang.ref
+java.lang.reflect
+java.net
+java.util
+java.util.spi
+
+#math
+java.math
+
+#nio
+java.nio
+java.nio.channels
+java.nio.channels.spi
+
+#nio-char
+java.nio.charset
+java.nio.charset.spi
+
+#prefs
+java.util.prefs
+
+#regex
+java.util.regex
+
+#rmi
+java.rmi
+java.rmi.activation
+java.rmi.dgc
+java.rmi.registry
+java.rmi.server
+javax.activity
+
+#security
+java.security
+java.security.acl
+java.security.cert
+java.security.interfaces
+java.security.spec
+javax.security.cert
+
+#sql
+java.sql
+javax.sql
+javax.sql.rowset
+javax.sql.rowset.spi
+javax.transaction
+javax.transaction.xa
+
+#text
+java.text
+
+#x-net
+javax.net
+javax.net.ssl
+
+#javax management
+javax.management
+javax.management.loading
+javax.management.modelmbean
+javax.management.monitor
+javax.management.openmbean
+javax.management.relation
+javax.management.timer
+
+#xml
+javax.xml
+javax.xml.datatype
+javax.xml.namespace
+javax.xml.parsers
+javax.xml.transform
+javax.xml.transform.dom
+javax.xml.transform.sax
+javax.xml.transform.stream
+javax.xml.validation
+javax.xml.xpath
+org.w3c.dom
+org.w3c.dom.bootstrap
+org.w3c.dom.events
+org.w3c.dom.ls
+org.xml.sax
+org.xml.sax.ext
+org.xml.sax.helpers

Added: harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/launching/environments/AccessRuleParticipant.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/launching/environments/AccessRuleParticipant.java?rev=792835&view=auto
==============================================================================
--- harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/launching/environments/AccessRuleParticipant.java (added)
+++ harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/launching/environments/AccessRuleParticipant.java Fri Jul 10 08:45:33 2009
@@ -0,0 +1,89 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.harmony.eclipse.jdt.launching.environments;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IAccessRule;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.LibraryLocation;
+import org.eclipse.jdt.launching.environments.IAccessRuleParticipant;
+import org.eclipse.jdt.launching.environments.IExecutionEnvironment;
+
+public class AccessRuleParticipant implements IAccessRuleParticipant {
+
+    static String[] packages = null;
+
+    public IAccessRule[][] getAccessRules(IExecutionEnvironment environment,
+            IVMInstall vm, LibraryLocation[] libraries, IJavaProject project) {
+
+        // Read list of packages
+        if (packages == null) {
+            try {
+                packages = getPackages();
+            } catch (IOException e) {
+                return new IAccessRule[0][];
+            }
+        }
+        // Set up rules for specific packages
+        IAccessRule[] packageRules = new IAccessRule[packages.length + 1];
+
+        // Allow named packages
+        for (int i = 0; i < packages.length; i++) {
+            Path path = new Path(packages[i].replace('.', IPath.SEPARATOR));
+            packageRules[i] = JavaCore.newAccessRule(path, IAccessRule.K_ACCESSIBLE);
+        }
+
+        // Disallow everything else
+        packageRules[packages.length] = JavaCore.newAccessRule(
+                new Path("**/*"), IAccessRule.K_NON_ACCESSIBLE); //$NON-NLS-1$
+
+        // These rules apply equally to all libraries
+        IAccessRule[][] allRules = new IAccessRule[libraries.length][];
+        for (int i = 0; i < allRules.length; i++) {
+            allRules[i] = packageRules;
+        }
+        return allRules;
+    }
+
+    private String[] getPackages() throws IOException {
+        InputStream is = this.getClass().getResourceAsStream("/Harmony-Select-1.0");
+        BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
+
+        ArrayList<String> pkgs = new ArrayList<String>(50);
+        String line = br.readLine();
+        while (line != null) {
+            line = line.trim();
+            if (line.length() != 0 && line.charAt(0) != '#') {
+                pkgs.add(line + "/*");
+            }
+            line = br.readLine();
+        }
+        br.close();
+
+        return pkgs.toArray(new String[pkgs.size()]);
+    }
+}

Propchange: harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/launching/environments/AccessRuleParticipant.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/launching/environments/Activator.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/launching/environments/Activator.java?rev=792835&view=auto
==============================================================================
--- harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/launching/environments/Activator.java (added)
+++ harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/launching/environments/Activator.java Fri Jul 10 08:45:33 2009
@@ -0,0 +1,67 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.harmony.eclipse.jdt.launching.environments;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+	// The plug-in ID
+	public static final String PLUGIN_ID = "org.apache.harmony.eclipse.jdt.launching.environments";
+
+	// The shared instance
+	private static Activator plugin;
+	
+	/**
+	 * The constructor
+	 */
+	public Activator() {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+	 */
+	public void start(BundleContext context) throws Exception {
+		super.start(context);
+		plugin = this;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+	 */
+	public void stop(BundleContext context) throws Exception {
+		plugin = null;
+		super.stop(context);
+	}
+
+	/**
+	 * Returns the shared instance
+	 *
+	 * @return the shared instance
+	 */
+	public static Activator getDefault() {
+		return plugin;
+	}
+
+}

Propchange: harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/launching/environments/Activator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/launching/environments/ExecutionEnvironmentAnalyzer.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/launching/environments/ExecutionEnvironmentAnalyzer.java?rev=792835&view=auto
==============================================================================
--- harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/launching/environments/ExecutionEnvironmentAnalyzer.java (added)
+++ harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/launching/environments/ExecutionEnvironmentAnalyzer.java Fri Jul 10 08:45:33 2009
@@ -0,0 +1,63 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.harmony.eclipse.jdt.launching.environments;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.IVMInstall2;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jdt.launching.environments.CompatibleEnvironment;
+import org.eclipse.jdt.launching.environments.IExecutionEnvironment;
+import org.eclipse.jdt.launching.environments.IExecutionEnvironmentAnalyzerDelegate;
+import org.eclipse.jdt.launching.environments.IExecutionEnvironmentsManager;
+
+public class ExecutionEnvironmentAnalyzer implements
+        IExecutionEnvironmentAnalyzerDelegate {
+
+    public CompatibleEnvironment[] analyze(IVMInstall vm, IProgressMonitor monitor)
+            throws CoreException {
+
+        // Get the Java version string from the VM
+        if (!(vm instanceof IVMInstall2))
+            return new CompatibleEnvironment[0];
+        IVMInstall2 vm2 = (IVMInstall2) vm;
+
+        String javaVersion = vm2.getJavaVersion();
+        if (javaVersion == null) {
+            return new CompatibleEnvironment[0];
+        }
+
+        // Select is a subset of SE runtimes that are 1.5 or above
+        if (javaVersion.startsWith("1.7") || javaVersion.startsWith("1.6")
+                || javaVersion.startsWith("1.5")) {
+
+            IExecutionEnvironmentsManager manager = JavaRuntime
+                    .getExecutionEnvironmentsManager();
+            IExecutionEnvironment env = manager.getEnvironment("Harmony-Select-1.0");
+            if (env != null) {
+                CompatibleEnvironment[] result = new CompatibleEnvironment[1];
+                result[0] = new CompatibleEnvironment(env, false);
+                return result;
+            }
+        }
+
+        // We didn't match as a subset
+        return new CompatibleEnvironment[0];
+    }
+}

Propchange: harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.jdt.launching.environments/src/org/apache/harmony/eclipse/jdt/launching/environments/ExecutionEnvironmentAnalyzer.java
------------------------------------------------------------------------------
    svn:eol-style = native