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%2FOsgiBootEquinoxLaunchConfiguration.java;h=6f2a93d3ce154b5048460aba5d032d7f75a44d1b;hb=24f738dcddf83ec2c13fe2e7498a47a4bcd0f427;hp=ab2db16d2543da00053d9c76a6ad0db194e5deb3;hpb=1ec88bb547b163d84d4e3eecc87cf78ecbd28f6c;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 ab2db16d2..6f2a93d3c 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,5 +1,6 @@ package org.argeo.slc.ide.ui.launch.osgi; +import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -8,6 +9,7 @@ import java.util.Properties; import org.argeo.slc.ide.ui.SlcIdeUiPlugin; import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.debug.core.ILaunch; @@ -15,6 +17,7 @@ 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; public class OsgiBootEquinoxLaunchConfiguration extends @@ -29,16 +32,16 @@ public class OsgiBootEquinoxLaunchConfiguration extends // TODO: add launch listener to be notified when is terminated and // refresh resources - - // IFile propertiesFile = (IFile) configuration.getMappedResources()[0]; - // propertiesFile.getProject().refreshLocal(IResource.DEPTH_INFINITE, - // monitor); + + IFile propertiesFile = (IFile) configuration.getMappedResources()[0]; + propertiesFile.getProject().refreshLocal(IResource.DEPTH_INFINITE, + monitor); } @Override protected void preLaunchCheck(ILaunchConfiguration configuration, ILaunch launch, IProgressMonitor monitor) throws CoreException { - System.out.println("Launching... " + launch); + // System.out.println("Launching... " + launch); IFile propertiesFile = (IFile) configuration.getMappedResources()[0]; Properties properties = null; @@ -54,9 +57,27 @@ public class OsgiBootEquinoxLaunchConfiguration extends 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); + systemPropertiesToAppend, null, new File(workingDir, "data") + .getAbsolutePath()); wc.doSave(); super.preLaunchCheck(configuration, launch, monitor);