Author: Grid.Qian
Date: 2008-06-06 05:48:28 -0400 (Fri, 06 Jun 2008)
New Revision: 8599
Modified:
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/classpath/JbossWSRuntimeClassPathInitializer.java
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/utils/JbossWSCoreUtils.java
Log:
JBIDE-2261: support multi runtimes
Modified:
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/classpath/JbossWSRuntimeClassPathInitializer.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/classpath/JbossWSRuntimeClassPathInitializer.java 2008-06-06
09:13:45 UTC (rev 8598)
+++
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/classpath/JbossWSRuntimeClassPathInitializer.java 2008-06-06
09:48:28 UTC (rev 8599)
@@ -22,6 +22,7 @@
public JbossWSRuntimeClassPathInitializer() {
}
+ private String segment;
@Override
public void initialize(IPath containerPath, IJavaProject project)
@@ -34,6 +35,7 @@
JavaCore.setClasspathContainer(containerPath,
new IJavaProject[] { project },
new IClasspathContainer[] { container }, null);
+ segment = containerPath.segment(1);
}
}
@@ -65,7 +67,7 @@
public IClasspathEntry[] getClasspathEntries() {
if (entries == null) {
ArrayList<IClasspathEntry> list = new ArrayList<IClasspathEntry>();
- IPath wsPath = JbossWSCoreUtils.getJbossWSRuntimePath(null);
+ IPath wsPath = JbossWSCoreUtils.getJbossWSRuntimePath(segment);
if (wsPath != null) {
IPath libPath = wsPath.append(JbossWSCoreMessages.Dir_Lib);
list.addAll(Arrays.asList(getEntries(libPath)));
Modified:
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/utils/JbossWSCoreUtils.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/utils/JbossWSCoreUtils.java 2008-06-06
09:13:45 UTC (rev 8598)
+++
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/utils/JbossWSCoreUtils.java 2008-06-06
09:48:28 UTC (rev 8599)
@@ -36,6 +36,7 @@
import org.jboss.tools.ws.core.JbossWSCorePlugin;
import org.jboss.tools.ws.core.classpath.JbossWSRuntime;
import org.jboss.tools.ws.core.classpath.JbossWSRuntimeListConverter;
+import org.jboss.tools.ws.core.classpath.JbossWSRuntimeManager;
import org.jboss.tools.ws.core.messages.JbossWSCoreMessages;
/**
@@ -220,32 +221,26 @@
}
public static IPath getJbossWSRuntimePath(String runtimeName) {
- Map<String, JbossWSRuntime> runtimes = getJbossWSRutntimeMap();
+ JbossWSRuntime[] runtimes = JbossWSRuntimeManager.getInstance().getRuntimes();
+ if(runtimes == null || runtimes.length == 0){
+ return null;
+ }
if (runtimeName == null || runtimeName.equals("")) {
- for (JbossWSRuntime rt : runtimes.values()) {
+ for (JbossWSRuntime rt : runtimes) {
if (rt.isDefault()) {
return new Path(rt.getHomeDir());
}
}
return null;
+ } else {
+ for (JbossWSRuntime rt : runtimes) {
+ if(rt.getName().equals(runtimeName)){
+ return new Path(rt.getHomeDir());
+ }
+ }
}
- if (runtimes.get(runtimeName) != null) {
- return new Path(runtimes.get(runtimeName).getHomeDir());
- }
return null;
}
- public static Map<String, JbossWSRuntime> getJbossWSRutntimeMap(){
- IPreferenceStore ps = JbossWSCorePlugin.getDefault()
- .getPreferenceStore();
- String runtimeLocation = ps.getString(JbossWSCoreMessages.WS_Location);
- if (runtimeLocation == null || runtimeLocation.equals("")) {
- return new HashMap<String, JbossWSRuntime>();
- }
- Map<String, JbossWSRuntime> runtimes = new HashMap<String,
JbossWSRuntime>();
- JbossWSRuntimeListConverter converter = new JbossWSRuntimeListConverter();
- runtimes = converter.getMap(runtimeLocation);
- return runtimes;
- }
}
Show replies by date