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%2FOsgiBootEquinoxLaunchConfiguration.java;h=19cdee12b8b1896f839293499d8fd66f208f9e3b;hb=868102c0f0220e12eca836b6ec9b3a2b9a3441e4;hp=e619e44f13fa89354ac1b5c4ced5f3e4c7092a8e;hpb=6e4e2314ce0605519c6165a7e34fde9a3418217a;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/OsgiBootEquinoxLaunchConfiguration.java b/eclipse/plugins/org.argeo.slc.ide.ui/src/main/java/org/argeo/slc/ide/ui/launch/osgi/OsgiBootEquinoxLaunchConfiguration.java index e619e44f1..19cdee12b 100644 --- a/eclipse/plugins/org.argeo.slc.ide.ui/src/main/java/org/argeo/slc/ide/ui/launch/osgi/OsgiBootEquinoxLaunchConfiguration.java +++ b/eclipse/plugins/org.argeo.slc.ide.ui/src/main/java/org/argeo/slc/ide/ui/launch/osgi/OsgiBootEquinoxLaunchConfiguration.java @@ -1,12 +1,5 @@ package org.argeo.slc.ide.ui.launch.osgi; -import java.io.File; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; - import org.argeo.slc.ide.ui.SlcIdeUiPlugin; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IResource; @@ -15,11 +8,9 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.pde.ui.launcher.EquinoxLaunchConfiguration; -import org.eclipse.pde.ui.launcher.OSGiLaunchShortcut; -import org.eclipse.swt.widgets.Display; +import org.eclipse.pde.launching.EquinoxLaunchConfiguration; +/** OSGiBoot launch configuration. */ public class OsgiBootEquinoxLaunchConfiguration extends EquinoxLaunchConfiguration { public final static String ID = SlcIdeUiPlugin.ID @@ -30,59 +21,35 @@ public class OsgiBootEquinoxLaunchConfiguration extends ILaunch launch, IProgressMonitor monitor) throws CoreException { super.launch(configuration, mode, launch, monitor); - // TODO: add launch listener to be notified when is terminated and - // refresh resources +// System.out.println("targetBundles=" +// + configuration.getAttribute( +// IPDELauncherConstants.TARGET_BUNDLES, "")); +// System.out.println("workspaceBundles=" +// + configuration.getAttribute( +// IPDELauncherConstants.WORKSPACE_BUNDLES, "")); - IFile propertiesFile = (IFile) configuration.getMappedResources()[0]; + // Refresh resources before launching + final IFile propertiesFile = (IFile) configuration.getMappedResources()[0]; propertiesFile.getParent().refreshLocal(IResource.DEPTH_INFINITE, monitor); -// propertiesFile.getProject().refreshLocal(IResource.DEPTH_INFINITE, -// monitor); } @Override protected void preLaunchCheck(ILaunchConfiguration configuration, ILaunch launch, IProgressMonitor monitor) throws CoreException { // System.out.println("Launching... " + launch); - IFile propertiesFile = (IFile) configuration.getMappedResources()[0]; - - Properties properties = null; - try { - properties = OsgiLaunchHelper.readProperties(propertiesFile); - } catch (CoreException e) { - ErrorDialog.openError(Display.getCurrent().getActiveShell(), - "Error", "Cannot execute launch shortcut", e.getStatus()); - return; - } - - List bundlesToStart = new ArrayList(); - Map systemPropertiesToAppend = new HashMap(); - OsgiLaunchHelper.interpretProperties(properties, bundlesToStart, - systemPropertiesToAppend); - - File workingDir = getWorkingDirectory(configuration); - ILaunchConfigurationWorkingCopy wc = configuration.getWorkingCopy(); - - // Reinitialize using standard OSGi launch shortcut - // Kind of a hack but it lacks extension capabilities and it is still - // cleaner than forking the code (which would imply a lot of fork indeed - // because of all the internal classes) - new OSGiLaunchShortcut() { - @Override - public void initializeConfiguration( - ILaunchConfigurationWorkingCopy configuration) { - // TODO Auto-generated method stub - super.initializeConfiguration(configuration); - } - }.initializeConfiguration(wc); - - OsgiLaunchHelper.updateLaunchConfiguration(wc, bundlesToStart, - systemPropertiesToAppend, null, new File(workingDir, "data") - .getAbsolutePath()); + OsgiLaunchHelper.updateLaunchConfiguration(wc, false); wc.doSave(); - super.preLaunchCheck(configuration, launch, monitor); + + // Note that if a Java project contains a build.properties it has to + // declare the sources otherwise it will be skipped in the generation of + // the dev.properties file! + + // for(Object bundleId:fAllBundles.keySet()){ + // System.out.println(bundleId+"="+fAllBundles.get(bundleId)); + // } } }