Author: Grid.Qian
Date: 2008-06-12 04:02:40 -0400 (Thu, 12 Jun 2008)
New Revision: 8739
Modified:
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/classpath/JbossWSRuntimeClassPathInitializer.java
Log:
JBIDE-2261: modify jbossws classpath container to support jars that are specified by user
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-12
07:19:23 UTC (rev 8738)
+++
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/classpath/JbossWSRuntimeClassPathInitializer.java 2008-06-12
08:02:40 UTC (rev 8739)
@@ -70,17 +70,29 @@
ArrayList<IClasspathEntry> entryList = new ArrayList<IClasspathEntry>();
JbossWSRuntime jbws = JbossWSRuntimeManager.getInstance()
.findRuntimeByName(segment);
- IPath wsPath = null;
- if (jbws != null) {
- wsPath = new Path(jbws.getHomeDir());
+ if (jbws.isUserConfigClasspath()) {
+ for (String jar : jbws.getLibraries()) {
+ entryList.add(getEntry(new Path(jar)));
+ }
+ entries = entryList.toArray(new IClasspathEntry[entryList
+ .size()]);
+ } else {
+ IPath wsPath = null;
+ if (jbws != null) {
+ wsPath = new Path(jbws.getHomeDir());
+ }
+ if (wsPath != null) {
+ IPath libPath = wsPath
+ .append(JbossWSCoreMessages.Dir_Lib);
+ entryList.addAll(Arrays.asList(getEntries(libPath,
+ entryList)));
+ libPath = wsPath.append(JbossWSCoreMessages.Dir_Client);
+ entryList.addAll(Arrays.asList(getEntries(libPath,
+ entryList)));
+ entries = entryList
+ .toArray(new IClasspathEntry[entryList.size()]);
+ }
}
- if (wsPath != null) {
- IPath libPath = wsPath.append(JbossWSCoreMessages.Dir_Lib);
- entryList.addAll(Arrays.asList(getEntries(libPath,entryList)));
- libPath = wsPath.append(JbossWSCoreMessages.Dir_Client);
- entryList.addAll(Arrays.asList(getEntries(libPath,entryList)));
- entries = entryList.toArray(new IClasspathEntry[entryList.size()]);
- }
if (entries == null)
return new IClasspathEntry[0];
}
@@ -92,15 +104,17 @@
.getClasspathEntry();
}
- protected IClasspathEntry[] getEntries(IPath folder, ArrayList<IClasspathEntry>
entryList) {
+ protected IClasspathEntry[] getEntries(IPath folder,
+ ArrayList<IClasspathEntry> entryList) {
String[] files = folder.toFile().list();
ArrayList<IClasspathEntry> list = new ArrayList<IClasspathEntry>();
for (int i = 0; i < files.length; i++) {
- if (files[i].endsWith(".jar") && filterJars(files[i],entryList)) {
+ if (files[i].endsWith(".jar")
+ && filterJars(files[i], entryList)) {
list.add(getEntry(folder.append(files[i])));
} else if (folder.append(files[i]).toFile().isDirectory()) {
list.addAll(Arrays.asList(getEntries(folder
- .append(files[i]),entryList)));
+ .append(files[i]), entryList)));
}
}
return list.toArray(new IClasspathEntry[list.size()]);
@@ -123,8 +137,8 @@
}
public boolean filterJars(String jarName, ArrayList<IClasspathEntry> list) {
- for(IClasspathEntry entry : list){
- if(entry.getPath().lastSegment().equals(jarName)){
+ for (IClasspathEntry entry : list) {
+ if (entry.getPath().lastSegment().equals(jarName)) {
return false;
}
}
Show replies by date