Author: Grid.Qian
Date: 2008-05-08 22:50:12 -0400 (Thu, 08 May 2008)
New Revision: 8018
Added:
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/classpath/
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/classpath/JbossWSRuntimeClassPathInitializer.java
Modified:
trunk/ws/plugins/org.jboss.tools.ws.core/META-INF/MANIFEST.MF
trunk/ws/plugins/org.jboss.tools.ws.core/plugin.xml
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/JbossWSCore.properties
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/JbossWSCoreMessages.java
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/command/JbossWSClassPathCommand.java
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/command/JbossWSRuntimeCommand.java
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/utils/JbossWSCoreUtils.java
Log:
modify for spell error and add support for ws project classpath --jira2047
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-05-09 02:49:57 UTC
(rev 8017)
+++ trunk/ws/plugins/org.jboss.tools.ws.core/META-INF/MANIFEST.MF 2008-05-09 02:50:12 UTC
(rev 8018)
@@ -11,7 +11,8 @@
org.eclipse.wst.common.frameworks,
org.eclipse.core.resources,
org.eclipse.jst.ws,
- org.eclipse.jdt.core
+ org.eclipse.jdt.core,
+ org.eclipse.jdt.launching
Eclipse-LazyStart: true
Bundle-Vendor: %PLUGIN_PROVIDER
Export-Package: org.jboss.tools.ws.core,
Modified: trunk/ws/plugins/org.jboss.tools.ws.core/plugin.xml
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.core/plugin.xml 2008-05-09 02:49:57 UTC (rev
8017)
+++ trunk/ws/plugins/org.jboss.tools.ws.core/plugin.xml 2008-05-09 02:50:12 UTC (rev
8018)
@@ -55,6 +55,13 @@
<runtime-component
any="true"/>
</supported>
+ </extension>
+ <extension
+ point="org.eclipse.jdt.core.classpathContainerInitializer">
+ <classpathContainerInitializer
+
class="org.jboss.tools.ws.core.classpath.JbossWSRuntimeClassPathInitializer"
+ id="JbossWSRuntimeLib">
+ </classpathContainerInitializer>
</extension>
</plugin>
Modified:
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/JbossWSCore.properties
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/JbossWSCore.properties 2008-05-09
02:49:57 UTC (rev 8017)
+++
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/JbossWSCore.properties 2008-05-09
02:50:12 UTC (rev 8018)
@@ -3,4 +3,5 @@
DIR_CLIENT=client
DIR_WEB_INF=WEB-INF
DIR_WEB_CONTENT=WebContent
-ERROR_COPY=Exception while copy JBossWS jars
\ No newline at end of file
+ERROR_COPY=Exception while copy JBossWS jars
+WS_LOCATION=jbosswsruntimelocation
\ No newline at end of file
Modified:
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/JbossWSCoreMessages.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/JbossWSCoreMessages.java 2008-05-09
02:49:57 UTC (rev 8017)
+++
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/JbossWSCoreMessages.java 2008-05-09
02:50:12 UTC (rev 8018)
@@ -27,6 +27,7 @@
public static String DIR_WEB_INF;
public static String DIR_WEB_CONTENT;
public static String ERROR_COPY;
+ public static String WS_LOCATION;
static {
Added:
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
(rev 0)
+++
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/classpath/JbossWSRuntimeClassPathInitializer.java 2008-05-09
02:50:12 UTC (rev 8018)
@@ -0,0 +1,108 @@
+package org.jboss.tools.ws.core.classpath;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.ClasspathContainerInitializer;
+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.tools.ws.core.utils.JbossWSCoreUtils;
+
+public class JbossWSRuntimeClassPathInitializer extends
+ ClasspathContainerInitializer {
+
+ public static final String ID = "JbossWSRuntimeLib";
+
+ public JbossWSRuntimeClassPathInitializer() {
+ }
+
+ @Override
+ public void initialize(IPath containerPath, IJavaProject project)
+ throws CoreException {
+
+ if (containerPath.segment(0).equals(ID)) {
+ JbossWSRuntimeClasspathContainer container = new JbossWSRuntimeClasspathContainer(
+ containerPath);
+ System.out.println(project.getElementName()+ " before
"+project.getRawClasspath().length);
+ for(int i=0;i<project.getRawClasspath().length;i++){
+ System.out.println(i+" classpath entry = " +
project.getRawClasspath()[i]);
+ }
+ JavaCore.setClasspathContainer(containerPath,
+ new IJavaProject[] {project},
+ new IClasspathContainer[] {container}, null);
+ System.out.println(project.getElementName()+" after
"+project.getRawClasspath().length);
+ for(int i=0;i<project.getRawClasspath().length;i++){
+ System.out.println(i+" classpath entry = " +
project.getRawClasspath()[i]);
+ }
+ }
+ }
+
+ public IClasspathEntry[] getEntries(IPath path) {
+ return new JbossWSRuntimeClasspathContainer(path).getClasspathEntries();
+ }
+
+ public class JbossWSRuntimeClasspathContainer implements
+ IClasspathContainer {
+ private IPath path;
+ private IClasspathEntry[] entries = null;
+
+ public JbossWSRuntimeClasspathContainer(IPath path) {
+ this.path = path;
+ }
+
+ public String getDescription() {
+ return "JBoss WS Runtime";
+ }
+
+ public int getKind() {
+ return IClasspathContainer.K_APPLICATION;
+ }
+
+ public IPath getPath() {
+ return path;
+ }
+
+ public IClasspathEntry[] getClasspathEntries() {
+ if (entries == null) {
+ loadClasspathEntries();
+ if (entries == null)
+ return new IClasspathEntry[0];
+ }
+ return entries;
+ }
+
+ private void loadClasspathEntries() {
+ ArrayList<IClasspathEntry> list = new ArrayList<IClasspathEntry>();
+ IPath libpath = JbossWSCoreUtils.getJbossLibPath();
+ list.addAll(Arrays.asList(getEntries(libpath)));
+ libpath = JbossWSCoreUtils.getJbossClientPath();
+
+ list.addAll(Arrays.asList(getEntries(libpath)));
+
+ entries = list.toArray(new IClasspathEntry[list.size()]);
+ }
+
+ protected IClasspathEntry getEntry(IPath path) {
+ return JavaRuntime.newArchiveRuntimeClasspathEntry(path)
+ .getClasspathEntry();
+ }
+
+ protected IClasspathEntry[] getEntries(IPath folder) {
+ String[] files = folder.toFile().list();
+ ArrayList<IClasspathEntry> list = new ArrayList<IClasspathEntry>();
+ for (int i = 0; i < files.length; i++) {
+ if (files[i].endsWith(".jar")) {
+ list.add(getEntry(folder.append(files[i])));
+ }//else if(new File(files[i] instanceof Folder)){}
+ }
+ return list.toArray(new IClasspathEntry[list.size()]);
+ }
+
+ }
+
+}
Modified:
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/command/JbossWSClassPathCommand.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/command/JbossWSClassPathCommand.java 2008-05-09
02:49:57 UTC (rev 8017)
+++
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/command/JbossWSClassPathCommand.java 2008-05-09
02:50:12 UTC (rev 8018)
@@ -14,15 +14,10 @@
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
-import org.jboss.tools.ws.core.JbossWSCoreMessages;
-import org.jboss.tools.ws.core.JbossWSCorePlugin;
import org.jboss.tools.ws.core.utils.JbossWSCoreUtils;
public class JbossWSClassPathCommand extends AbstractDataModelOperation {
Modified:
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/command/JbossWSRuntimeCommand.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/command/JbossWSRuntimeCommand.java 2008-05-09
02:49:57 UTC (rev 8017)
+++
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/command/JbossWSRuntimeCommand.java 2008-05-09
02:50:12 UTC (rev 8018)
@@ -17,12 +17,9 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
import org.jboss.tools.ws.core.JbossWSCoreMessages;
-import org.jboss.tools.ws.core.JbossWSCorePlugin;
import org.jboss.tools.ws.core.utils.JbossWSCoreUtils;
public class JbossWSRuntimeCommand extends AbstractDataModelOperation {
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-05-09
02:49:57 UTC (rev 8017)
+++
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/utils/JbossWSCoreUtils.java 2008-05-09
02:50:12 UTC (rev 8018)
@@ -223,11 +223,12 @@
try {
IJavaProject javaProject = JavaCore.create(project);
+
IClasspathEntry newClasspath = JavaCore
- .newContainerEntry(getJbossLibPath());
+ .newContainerEntry(new Path("JbossWSRuntimeLib"));
IClasspathEntry[] oldClasspathEntries = javaProject
- .getRawClasspath();
+ .readRawClasspath();
boolean isFolderInClassPathAlready = false;
for (int i = 0; i < oldClasspathEntries.length
@@ -263,10 +264,38 @@
public static IPath getJbossLibPath() {
IPreferenceStore ps = JbossWSCorePlugin.getDefault()
.getPreferenceStore();
- String runtimeLocation = ps.getString("jbosswsruntimelocation");
+ String runtimeLocation = ps.getString(JbossWSCoreMessages.WS_LOCATION);
+
+ if(runtimeLocation == null || runtimeLocation.equals("")){
+
+ }
IPath libPath = new Path(runtimeLocation);
return libPath.append(JbossWSCoreMessages.DIR_LIB);
}
+
+ public static IPath getJbossClientPath() {
+ IPreferenceStore ps = JbossWSCorePlugin.getDefault()
+ .getPreferenceStore();
+ String runtimeLocation = ps.getString(JbossWSCoreMessages.WS_LOCATION);
+
+ if(runtimeLocation == null || runtimeLocation.equals("")){
+
+ }
+ IPath libPath = new Path(runtimeLocation);
+ return libPath.append(JbossWSCoreMessages.DIR_CLIENT);
+ }
+
+ public static IPath getJbossWSRuntimePath() {
+ IPreferenceStore ps = JbossWSCorePlugin.getDefault()
+ .getPreferenceStore();
+ String runtimeLocation = ps.getString(JbossWSCoreMessages.WS_LOCATION);
+
+ if(runtimeLocation == null || runtimeLocation.equals("")){
+
+ }
+ return new Path(runtimeLocation);
+ }
+
}
Show replies by date