Author: koen.aers(a)jboss.com
Date: 2011-07-14 12:26:25 -0400 (Thu, 14 Jul 2011)
New Revision: 32920
Modified:
trunk/forge/plugins/org.jboss.tools.forge.core/src/org/jboss/tools/forge/core/process/ForgeLaunchHelper.java
Log:
add the classes of the org.jboss.tools.runtime.ext on the classpath if they are present
Modified:
trunk/forge/plugins/org.jboss.tools.forge.core/src/org/jboss/tools/forge/core/process/ForgeLaunchHelper.java
===================================================================
---
trunk/forge/plugins/org.jboss.tools.forge.core/src/org/jboss/tools/forge/core/process/ForgeLaunchHelper.java 2011-07-14
15:46:34 UTC (rev 32919)
+++
trunk/forge/plugins/org.jboss.tools.forge.core/src/org/jboss/tools/forge/core/process/ForgeLaunchHelper.java 2011-07-14
16:26:25 UTC (rev 32920)
@@ -1,14 +1,18 @@
package org.jboss.tools.forge.core.process;
import java.io.File;
+import java.io.FileFilter;
import java.io.FilenameFilter;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
@@ -63,11 +67,35 @@
List<String> result = new ArrayList<String>();
result = addUserClasses(result, location);
if (result != null) {
+ result = addExtClasses(result);
result = addSystemLibs(result);
}
return result;
}
+ private static List<String> addExtClasses(List<String> classPath) {
+ try {
+ File file =
FileLocator.getBundleFile(Platform.getBundle("org.jboss.tools.forge.runtime.ext"));
+ if (file != null) {
+ if (file.isDirectory()) {
+ File[] files = file.listFiles(new FileFilter() {
+ public boolean accept(File pathname) {
+ return pathname.getAbsolutePath().endsWith("bin");
+ }
+ });
+ if (files.length > 0) {
+ classPath.add(createUserClassEntryMemento(files[0]));
+ }
+ } else {
+ classPath.add(createUserClassEntryMemento(file));
+ }
+ }
+ } catch (IOException e) {
+ ForgeCorePlugin.log(new RuntimeException("Problem while adding ext lib
entry", e));
+ }
+ return classPath;
+ }
+
private static List<String> addSystemLibs(List<String> classPath) {
try {
IPath systemLibsPath = new Path(JavaRuntime.JRE_CONTAINER);
Show replies by date