X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;ds=sidebyside;f=eclipse%2Fplugins%2Forg.argeo.slc.ide.ui%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fide%2Fui%2Flaunch%2Fosgi%2FOsgiLaunchHelper.java;fp=eclipse%2Fplugins%2Forg.argeo.slc.ide.ui%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fide%2Fui%2Flaunch%2Fosgi%2FOsgiLaunchHelper.java;h=c7494723607fef0fdf982713cbfd8542bc638770;hb=24f738dcddf83ec2c13fe2e7498a47a4bcd0f427;hp=425352beb42f870c67ddbc312d508784505be086;hpb=67235a82e5020e55e1b2250546645c9ee617f420;p=gpl%2Fargeo-slc.git diff --git a/eclipse/plugins/org.argeo.slc.ide.ui/src/main/java/org/argeo/slc/ide/ui/launch/osgi/OsgiLaunchHelper.java b/eclipse/plugins/org.argeo.slc.ide.ui/src/main/java/org/argeo/slc/ide/ui/launch/osgi/OsgiLaunchHelper.java index 425352beb..c74947236 100644 --- a/eclipse/plugins/org.argeo.slc.ide.ui/src/main/java/org/argeo/slc/ide/ui/launch/osgi/OsgiLaunchHelper.java +++ b/eclipse/plugins/org.argeo.slc.ide.ui/src/main/java/org/argeo/slc/ide/ui/launch/osgi/OsgiLaunchHelper.java @@ -27,8 +27,8 @@ public class OsgiLaunchHelper { public static void updateLaunchConfiguration( ILaunchConfigurationWorkingCopy configuration, List bundlesToStart, - Map systemPropertiesToAppend, String dir) - throws CoreException { + Map systemPropertiesToAppend, String workingDir, + String dataDir) throws CoreException { // Convert bundle lists String targetBundles = configuration.getAttribute( IPDELauncherConstants.TARGET_BUNDLES, ""); @@ -79,15 +79,31 @@ public class OsgiLaunchHelper { for (String key : systemPropertiesToAppend.keySet()) addSysProperty(vmArgs, key, systemPropertiesToAppend.get(key)); + if (dataDir != null) + addSysProperty(vmArgs, OsgiLauncherConstants.ARGEO_OSGI_DATA_DIR, + dataDir); + configuration.setAttribute( IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, vmArgs .toString()); + // Program arguments + String defaultProgArgs = configuration.getAttribute( + OsgiLauncherConstants.ATTR_DEFAULT_PROGRAM_ARGS, ""); + StringBuffer progArgs = new StringBuffer(defaultProgArgs); + if (dataDir != null) { + progArgs.append(" -data "); + progArgs.append(surroundSpaces(dataDir)); + } + configuration.setAttribute( + IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, + progArgs.toString()); + // String dir = findWorkingDirectory(); - if (dir != null) + if (workingDir != null) configuration.setAttribute( IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, - dir); + workingDir); } @@ -100,39 +116,50 @@ public class OsgiLaunchHelper { protected static void addSysProperty(StringBuffer vmArgs, String key, String value) { String str = "-D" + key + "=" + value; - if (str.contains(" ")) - str = "\"" + str + "\""; + surroundSpaces(str); vmArgs.append(" " + str); } + protected static String surroundSpaces(String str) { + if (str.contains(" ")) + return "\"" + str + "\""; + else + return str; + } + protected static String convertBundleList(List bundlesToStart, String original) { StringBuffer bufBundles = new StringBuffer(1024); StringTokenizer stComa = new StringTokenizer(original, ","); boolean first = true; - while (stComa.hasMoreTokens()) { + bundles: while (stComa.hasMoreTokens()) { if (first) first = false; else bufBundles.append(','); - String tkComa = stComa.nextToken(); - int indexAt = tkComa.indexOf('@'); + String bundleId = stComa.nextToken(); + int indexAt = bundleId.indexOf('@'); boolean modified = false; if (indexAt >= 0) { - String bundelId = tkComa.substring(0, indexAt); - - if (bundlesToStart.contains(bundelId)) { - bufBundles.append(bundelId).append('@').append( - "default:true"); - modified = true; - if (debug) - System.out.println("Will start " + bundelId); - } + bundleId = bundleId.substring(0, indexAt); + } + + if (bundleId.endsWith(".source")) { + if (debug) + System.out.println("Skip source bundle " + bundleId); + continue bundles; + } + + if (bundlesToStart.contains(bundleId)) { + bufBundles.append(bundleId).append('@').append("default:true"); + modified = true; + if (debug) + System.out.println("Will start " + bundleId); } if (!modified) - bufBundles.append(tkComa); + bufBundles.append(bundleId); } String output = bufBundles.toString(); return output;