Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 54044 Details for
Bug 163444
Associate access restrictions with execution environments
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch
darin.txt (text/plain), 10.50 KB, created by
Wassim Melhem
on 2006-11-16 19:59:43 EST
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Wassim Melhem
Created:
2006-11-16 19:59:43 EST
Size:
10.50 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.launching >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.launching/plugin.xml,v >retrieving revision 1.63 >diff -u -r1.63 plugin.xml >--- plugin.xml 14 Nov 2006 21:28:43 -0000 1.63 >+++ plugin.xml 17 Nov 2006 00:53:26 -0000 >@@ -193,5 +193,43 @@ > name= "%jreContainerMarkerProblemName"> > <super type="org.eclipse.core.resources.problemmarker"/> > <persistent value="true"/> >- </extension> >+ </extension> >+ >+ <extension >+ point="org.eclipse.jdt.launching.executionEnvironments"> >+ <environment >+ id="OSGi/Minimum-1.0" >+ description="%environment.description.0"/> >+ <environment >+ id="OSGi/Minimum-1.1" >+ description="%environment.description.1"/> >+ <environment >+ id="JRE-1.1" >+ description="%environment.description.2"/> >+ <environment >+ id="J2SE-1.2" >+ description="%environment.description.3"/> >+ <environment >+ id="J2SE-1.3" >+ description="%environment.description.4"/> >+ <environment >+ id="J2SE-1.4" >+ description="%environment.description.5"/> >+ <environment >+ id="J2SE-1.5" >+ description="%environment.description.6"/> >+ <environment >+ id="CDC-1.0/Foundation-1.0" >+ description="%environment.description.7"/> >+ <environment >+ id="CDC-1.1/Foundation-1.1" >+ description="%environment.description.8"/> >+ <environment >+ id="JavaSE-1.6" >+ description="%environment.description.9"/> >+ <analyzer >+ class="org.eclipse.jdt.internal.launching.environments.ExecutionEnvironmentAnalyzer" >+ id="org.eclipse.pde.core.eeAnalyzer"/> >+ </extension> >+ > </plugin> >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.launching/plugin.properties,v >retrieving revision 1.25 >diff -u -r1.25 plugin.properties >--- plugin.properties 14 Nov 2006 21:28:43 -0000 1.25 >+++ plugin.properties 17 Nov 2006 00:53:26 -0000 >@@ -42,3 +42,14 @@ > classpathVariableSourceContainerType.description= Workspace folder, local directory, or archive referenced by a variable path > classpathContainerSourceContainerType.name= Java Library > classpathContainerSourceContainerType.description= A collection of binary archives with attached source >+ >+environment.description.0 = Minimum environment to run the OSGi framework 1.0 >+environment.description.1 = Minimum environment to run the OSGi framework 1.1 >+environment.description.2 = Java Runtime Environment 1.1 >+environment.description.3 = Java 2 Platform, Standard Edition 1.2 >+environment.description.4 = Java 2 Platform, Standard Edition 1.3 >+environment.description.5 = Java 2 Platform, Standard Edition 1.4 >+environment.description.6 = Java 2 Platform, Standard Edition 5.0 >+environment.description.7 = CDC 1.0, Foundation 1.0 >+environment.description.8 = CDC 1.1, Foundation 1.1 >+environment.description.9 = Java Platform, Standard Edition 6.0 >Index: launching/org/eclipse/jdt/internal/launching/environments/ExecutionEnvironmentAnalyzer.java >=================================================================== >RCS file: launching/org/eclipse/jdt/internal/launching/environments/ExecutionEnvironmentAnalyzer.java >diff -N launching/org/eclipse/jdt/internal/launching/environments/ExecutionEnvironmentAnalyzer.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ launching/org/eclipse/jdt/internal/launching/environments/ExecutionEnvironmentAnalyzer.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,151 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are 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: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.internal.launching.environments; >+ >+import java.util.ArrayList; >+import java.util.HashMap; >+import java.util.List; >+import java.util.Map; >+import java.util.StringTokenizer; >+ >+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.IVMInstall3; >+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 { >+ >+ private static final String JavaSE_1_6 = "JavaSE-1.6"; //$NON-NLS-1$ >+ private static final String J2SE_1_5 = "J2SE-1.5"; //$NON-NLS-1$ >+ private static final String J2SE_1_4 = "J2SE-1.4"; //$NON-NLS-1$ >+ private static final String J2SE_1_3 = "J2SE-1.3"; //$NON-NLS-1$ >+ private static final String J2SE_1_2 = "J2SE-1.2"; //$NON-NLS-1$ >+ private static final String JRE_1_1 = "JRE-1.1"; //$NON-NLS-1$ >+ >+ private static final String CDC_FOUNDATION_1_1 = "CDC-1.1/Foundation-1.1"; //$NON-NLS-1$ >+ private static final String CDC_FOUNDATION_1_0 = "CDC-1.0/Foundation-1.0"; //$NON-NLS-1$ >+ >+ private static final String OSGI_MINIMUM_1_0 = "OSGi/Minimum-1.0"; //$NON-NLS-1$ >+ private static final String OSGI_MINIMUM_1_1 = "OSGi/Minimum-1.1"; //$NON-NLS-1$ >+ >+ private static final String JAVA_SPEC_VERSION = "java.specification.version"; //$NON-NLS-1$ >+ private static final String JAVA_SPEC_NAME = "java.specification.name"; //$NON-NLS-1$ >+ private static final String JAVA_VERSION = "java.version"; //$NON-NLS-1$ >+ >+ private static final String[] VM_PROPERTIES = {JAVA_SPEC_NAME, JAVA_SPEC_VERSION, JAVA_VERSION}; >+ private static final String FOUNDATION = "foundation"; //$NON-NLS-1$ >+ private static final Map mappings = new HashMap(); >+ >+ static { >+ // table where the key is the EE and the value is an array of EEs that it is a super-set of >+ mappings.put(CDC_FOUNDATION_1_0, new String[] {OSGI_MINIMUM_1_0}); >+ mappings.put(CDC_FOUNDATION_1_1, new String[] {CDC_FOUNDATION_1_0, OSGI_MINIMUM_1_1}); >+ mappings.put(OSGI_MINIMUM_1_1, new String[] {OSGI_MINIMUM_1_0}); >+ mappings.put(J2SE_1_2, new String[] {JRE_1_1}); >+ mappings.put(J2SE_1_3, new String[] {J2SE_1_2, CDC_FOUNDATION_1_0, OSGI_MINIMUM_1_0}); >+ mappings.put(J2SE_1_4, new String[] {J2SE_1_3, CDC_FOUNDATION_1_1, OSGI_MINIMUM_1_1}); >+ mappings.put(J2SE_1_5, new String[] {J2SE_1_4}); >+ mappings.put(JavaSE_1_6, new String[] {J2SE_1_5}); >+ } >+ public CompatibleEnvironment[] analyze(IVMInstall vm, IProgressMonitor monitor) throws CoreException { >+ ArrayList result = new ArrayList(); >+ if (!(vm instanceof IVMInstall2)) >+ return new CompatibleEnvironment[0]; >+ IVMInstall2 vm2 = (IVMInstall2) vm; >+ >+ List types = null; >+ String javaVersion = vm2.getJavaVersion(); >+ if (javaVersion == null) { >+ // We have a contributed VM type. Check to see if its a foundation VM, if we can. >+ if ((vm instanceof IVMInstall3) && isFoundation1_0((IVMInstall3) vm)) >+ types = getTypes(CDC_FOUNDATION_1_0); >+ else if ((vm instanceof IVMInstall3) && isFoundation1_1((IVMInstall3) vm)) >+ types = getTypes(CDC_FOUNDATION_1_1); >+ } else { >+ if (javaVersion.startsWith("1.6")) //$NON-NLS-1$ >+ types = getTypes(JavaSE_1_6); >+ else if (javaVersion.startsWith("1.5")) //$NON-NLS-1$ >+ types = getTypes(J2SE_1_5); >+ else if (javaVersion.startsWith("1.4")) //$NON-NLS-1$ >+ types = getTypes(J2SE_1_4); >+ else if (javaVersion.startsWith("1.3")) //$NON-NLS-1$ >+ types = getTypes(J2SE_1_3); >+ else if (javaVersion.startsWith("1.2")) //$NON-NLS-1$ >+ types = getTypes(J2SE_1_2); >+ else if (javaVersion.startsWith("1.1")) { //$NON-NLS-1$ >+ if ((vm instanceof IVMInstall3) && isFoundation1_1((IVMInstall3) vm)) >+ types = getTypes(CDC_FOUNDATION_1_1); >+ else >+ types = getTypes(JRE_1_1); >+ } else if (javaVersion.startsWith("1.0")) { //$NON-NLS-1$ >+ if ((vm instanceof IVMInstall3) && isFoundation1_0((IVMInstall3) vm)) >+ types = getTypes(CDC_FOUNDATION_1_0); >+ } >+ } >+ >+ if (types != null) { >+ for (int i=0; i < types.size(); i++) >+ addEnvironment(result, (String) types.get(i), i ==0); >+ } >+ return (CompatibleEnvironment[])result.toArray(new CompatibleEnvironment[result.size()]); >+ } >+ >+ /* >+ * Check a couple of known system properties for the word "foundation". >+ */ >+ private boolean isFoundation(Map properties) { >+ for (int i=0; i < VM_PROPERTIES.length; i++) { >+ String value = (String) properties.get(VM_PROPERTIES[i]); >+ if (value == null) >+ continue; >+ for (StringTokenizer tokenizer = new StringTokenizer(value); tokenizer.hasMoreTokens(); ) >+ if (FOUNDATION.equalsIgnoreCase(tokenizer.nextToken())) >+ return true; >+ } >+ return false; >+ } >+ >+ private boolean isFoundation1_0(IVMInstall3 vm) throws CoreException { >+ Map map = vm.evaluateSystemProperties(VM_PROPERTIES, null); >+ return isFoundation(map) ? "1.0".equals(map.get(JAVA_SPEC_VERSION)) : false; //$NON-NLS-1$ >+ } >+ >+ private boolean isFoundation1_1(IVMInstall3 vm) throws CoreException { >+ Map map = vm.evaluateSystemProperties(VM_PROPERTIES, null); >+ return isFoundation(map) ? "1.1".equals(map.get(JAVA_SPEC_VERSION)) : false; //$NON-NLS-1$ >+ } >+ >+ private void addEnvironment(ArrayList result, String id, boolean strict) { >+ IExecutionEnvironmentsManager manager = JavaRuntime.getExecutionEnvironmentsManager(); >+ IExecutionEnvironment env = manager.getEnvironment(id); >+ if (env != null) >+ result.add(new CompatibleEnvironment(env, strict)); >+ } >+ >+ // first entry in the list is the perfect match >+ private List getTypes(String type) { >+ List result = new ArrayList(); >+ result.add(type); >+ String[] values = (String[]) mappings.get(type); >+ if (values != null) { >+ for (int i=0; i<values.length; i++) >+ result.addAll(getTypes(values[i])); >+ } >+ return result; >+ } >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 163444
: 54044 |
54683