X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=eclipse%2Fplugins%2Forg.argeo.slc.ide.ui%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fide%2Fui%2Flaunch%2Fosgi%2FOsgiLaunchHelper.java;h=3646a7b6d03b82758e1b0be8d7756906e371497a;hb=1ff8b2dd13c5a2472960bcde78946267da351013;hp=31aaf136f68dd9f82fc4f3aaf5fb0617e7c7092b;hpb=16016e4621c540a86bbc40c040bc9d528a5b573d;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 31aaf136f..3646a7b6d 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 @@ -26,6 +26,8 @@ import org.eclipse.jdt.launching.IVMInstall2; import org.eclipse.jdt.launching.IVMInstallType; import org.eclipse.jdt.launching.JavaRuntime; import org.eclipse.jface.dialogs.ErrorDialog; +import org.eclipse.pde.core.plugin.IPluginModelBase; +import org.eclipse.pde.core.plugin.PluginRegistry; import org.eclipse.pde.ui.launcher.IPDELauncherConstants; import org.eclipse.swt.widgets.Display; @@ -68,8 +70,17 @@ public class OsgiLaunchHelper implements OsgiLauncherConstants { Map systemPropertiesToAppend, String dataDir) throws CoreException { // Convert bundle lists - String targetBundles = configuration.getAttribute( - IPDELauncherConstants.TARGET_BUNDLES, ""); + final String targetBundles; + if (configuration.getAttribute(ATTR_SYNC_BUNDLES, true)) { + StringBuffer buf = new StringBuffer(); + for (IPluginModelBase model : PluginRegistry.getExternalModels()) { + buf.append(model.getBundleDescription().getSymbolicName()); + buf.append(','); + } + targetBundles = buf.toString(); + } else + targetBundles = configuration.getAttribute( + IPDELauncherConstants.TARGET_BUNDLES, ""); configuration.setAttribute(IPDELauncherConstants.TARGET_BUNDLES, convertBundleList(bundlesToStart, targetBundles)); @@ -111,6 +122,12 @@ public class OsgiLaunchHelper implements OsgiLauncherConstants { if (dataDir != null) { progArgs.append("-data "); progArgs.append(surroundSpaces(dataDir)); + + if (configuration.getAttribute(ATTR_CLEAR_DATA_DIRECTORY, false)) { + File dataDirFile = new File(dataDir); + deleteDir(dataDirFile); + dataDirFile.mkdirs(); + } } String additionalProgramArgs = configuration.getAttribute( OsgiLauncherConstants.ATTR_ADDITIONAL_PROGRAM_ARGS, ""); @@ -120,6 +137,17 @@ public class OsgiLaunchHelper implements OsgiLauncherConstants { progArgs.toString()); } + private static void deleteDir(File dir) { + File[] files = dir.listFiles(); + for (File file : files) { + if (file.isDirectory()) + deleteDir(file); + else + file.delete(); + } + dir.delete(); + } + protected static void addVms(StringBuffer vmArgs) { addVmSysProperty(vmArgs, "default", JavaRuntime.getDefaultVMInstall()); IVMInstallType[] vmTypes = JavaRuntime.getVMInstallTypes(); @@ -180,6 +208,12 @@ public class OsgiLaunchHelper implements OsgiLauncherConstants { bufBundles.append(','); String bundleId = stComa.nextToken(); + if (bundleId.indexOf('*') >= 0) + throw new RuntimeException( + "Bundle id " + + bundleId + + " not properly formatted, clean your workspace projects"); + int indexAt = bundleId.indexOf('@'); boolean modified = false; if (indexAt >= 0) {