Author: Grid.Qian
Date: 2008-11-11 03:12:16 -0500 (Tue, 11 Nov 2008)
New Revision: 11653
Modified:
trunk/ws/plugins/org.jboss.tools.ws.core/META-INF/MANIFEST.MF
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/classpath/JBossWSRuntimeClassPathInitializer.java
Log:
JBIDE-3157: WS classpath container should allow modification for source and JavaDoc
locations
Modified: trunk/ws/plugins/org.jboss.tools.ws.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.core/META-INF/MANIFEST.MF 2008-11-11 08:12:08 UTC
(rev 11652)
+++ trunk/ws/plugins/org.jboss.tools.ws.core/META-INF/MANIFEST.MF 2008-11-11 08:12:16 UTC
(rev 11653)
@@ -21,7 +21,8 @@
org.eclipse.jst.jsf.ui,
org.eclipse.jdt.launching,
org.eclipse.jst.j2ee,
- org.eclipse.jst.ws.consumption.ui
+ org.eclipse.jst.ws.consumption.ui,
+ org.jboss.ide.eclipse.as.classpath.core
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %PLUGIN_PROVIDER
Export-Package: org.jboss.tools.ws.core,
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-11-11
08:12:08 UTC (rev 11652)
+++
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/classpath/JBossWSRuntimeClassPathInitializer.java 2008-11-11
08:12:16 UTC (rev 11653)
@@ -17,20 +17,24 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.ClasspathContainerInitializer;
+import org.eclipse.jdt.core.IAccessRule;
+import org.eclipse.jdt.core.IClasspathAttribute;
import org.eclipse.jdt.core.IClasspathContainer;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.launching.JavaRuntime;
+import org.jboss.ide.eclipse.as.classpath.core.jee.AbstractClasspathContainer;
+import
org.jboss.ide.eclipse.as.classpath.core.jee.AbstractClasspathContainerInitializer;
+import org.jboss.ide.eclipse.as.classpath.core.xpl.ClasspathDecorations;
import org.jboss.tools.ws.core.messages.JBossWSCoreMessages;
/**
* @author Grid Qian
*/
public class JBossWSRuntimeClassPathInitializer extends
- ClasspathContainerInitializer {
-
+AbstractClasspathContainerInitializer {
+ public final static String JBOSS_WS_RUNTIME_CLASSPATH_CONTAINER_ID =
"org.jboss.ws.runtime.classpath";
public JBossWSRuntimeClassPathInitializer() {
}
@@ -55,12 +59,13 @@
return new JBossWSRuntimeClasspathContainer(path).getClasspathEntries();
}
- public class JBossWSRuntimeClasspathContainer implements
- IClasspathContainer {
+ public class JBossWSRuntimeClasspathContainer extends
+ AbstractClasspathContainer {
private IPath path;
private IClasspathEntry[] entries = null;
public JBossWSRuntimeClasspathContainer(IPath path) {
+ super(path,JBossWSCoreMessages.JBossWS_Runtime_Lib,null);
this.path = path;
}
@@ -75,7 +80,52 @@
public IPath getPath() {
return path;
}
+
+ public IClasspathEntry[] computeEntries() {
+ ArrayList<IClasspathEntry> entryList = new ArrayList<IClasspathEntry>();
+ JBossWSRuntime jbws = JBossWSRuntimeManager.getInstance()
+ .findRuntimeByName(segment);
+
+ List<String> jars = null;
+ if (jbws != null) {
+ jars = JBossWSRuntimeManager.getInstance().getAllRuntimeJars(jbws);
+ for (String jar : jars) {
+ entryList.add(getEntry(new Path(jar)));
+ }
+ }
+ if(jars == null){
+ return new IClasspathEntry[0];
+ }
+
+ for (String jar : jars) {
+ IPath entryPath = new Path(jar);
+
+ IPath sourceAttachementPath = null;
+ IPath sourceAttachementRootPath = null;
+
+ final ClasspathDecorations dec = decorations.getDecorations(
+ getDecorationManagerKey(getPath().toString()),
+ entryPath.toString());
+
+ IClasspathAttribute[] attrs = {};
+ if (dec != null) {
+ sourceAttachementPath = dec.getSourceAttachmentPath();
+ sourceAttachementRootPath = dec
+ .getSourceAttachmentRootPath();
+ attrs = dec.getExtraAttributes();
+ }
+
+ IAccessRule[] access = {};
+ IClasspathEntry entry = JavaCore.newLibraryEntry(entryPath,
+ sourceAttachementPath, sourceAttachementRootPath,
+ access, attrs, false);
+ entryList.add(entry);
+ }
+ entries = entryList.toArray(new IClasspathEntry[entryList.size()]);
+ return entries;
+ }
+
public IClasspathEntry[] getClasspathEntries() {
if (entries == null) {
ArrayList<IClasspathEntry> entryList = new ArrayList<IClasspathEntry>();
@@ -90,8 +140,35 @@
}
entries = entryList.toArray(new IClasspathEntry[entryList
.size()]);
- if (entries == null)
+ if(entryList.size() == 0){
return new IClasspathEntry[0];
+ }
+
+ for (String jar : jars) {
+
+ IPath entryPath = new Path(jar);
+
+ IPath sourceAttachementPath = null;
+ IPath sourceAttachementRootPath = null;
+
+ final ClasspathDecorations dec = decorations.getDecorations(
+ getDecorationManagerKey(getPath().toString()),
+ entryPath.toString());
+
+ IClasspathAttribute[] attrs = {};
+ if (dec != null) {
+ sourceAttachementPath = dec.getSourceAttachmentPath();
+ sourceAttachementRootPath = dec
+ .getSourceAttachmentRootPath();
+ attrs = dec.getExtraAttributes();
+ }
+
+ IAccessRule[] access = {};
+ IClasspathEntry entry = JavaCore.newLibraryEntry(entryPath,
+ sourceAttachementPath, sourceAttachementRootPath,
+ access, attrs, false);
+ entryList.add(entry);
+ }
}
}
return entries;
@@ -134,4 +211,14 @@
return true;
}
+ @Override
+ protected AbstractClasspathContainer createClasspathContainer(IPath path) {
+ return new JBossWSRuntimeClasspathContainer(path);
+ }
+
+ @Override
+ protected String getClasspathContainerID() {
+ return JBOSS_WS_RUNTIME_CLASSPATH_CONTAINER_ID;
+ }
+
}
Show replies by date