1 package org
.argeo
.slc
.ide
.ui
.launch
.osgi
;
3 import java
.util
.ArrayList
;
4 import java
.util
.HashMap
;
7 import java
.util
.Properties
;
9 import org
.argeo
.slc
.ide
.ui
.SlcIdeUiPlugin
;
10 import org
.eclipse
.core
.resources
.IFile
;
11 import org
.eclipse
.core
.runtime
.CoreException
;
12 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
13 import org
.eclipse
.debug
.core
.ILaunch
;
14 import org
.eclipse
.debug
.core
.ILaunchConfiguration
;
15 import org
.eclipse
.debug
.core
.ILaunchConfigurationWorkingCopy
;
16 import org
.eclipse
.jface
.dialogs
.ErrorDialog
;
17 import org
.eclipse
.pde
.ui
.launcher
.EquinoxLaunchConfiguration
;
18 import org
.eclipse
.swt
.widgets
.Display
;
20 public class OsgiBootEquinoxLaunchConfiguration
extends
21 EquinoxLaunchConfiguration
{
22 public final static String ID
= SlcIdeUiPlugin
.ID
23 + ".OsgiBootEquinoxLauncher";
26 public void launch(ILaunchConfiguration configuration
, String mode
,
27 ILaunch launch
, IProgressMonitor monitor
) throws CoreException
{
28 super.launch(configuration
, mode
, launch
, monitor
);
30 // TODO: add launch listener to be notified when is terminated and
33 // IFile propertiesFile = (IFile) configuration.getMappedResources()[0];
34 // propertiesFile.getProject().refreshLocal(IResource.DEPTH_INFINITE,
39 protected void preLaunchCheck(ILaunchConfiguration configuration
,
40 ILaunch launch
, IProgressMonitor monitor
) throws CoreException
{
41 System
.out
.println("Launching... " + launch
);
42 IFile propertiesFile
= (IFile
) configuration
.getMappedResources()[0];
44 Properties properties
= null;
46 properties
= OsgiLaunchHelper
.readProperties(propertiesFile
);
47 } catch (CoreException e
) {
48 ErrorDialog
.openError(Display
.getCurrent().getActiveShell(),
49 "Error", "Cannot execute launch shortcut", e
.getStatus());
53 List
<String
> bundlesToStart
= new ArrayList
<String
>();
54 Map
<String
, String
> systemPropertiesToAppend
= new HashMap
<String
, String
>();
55 OsgiLaunchHelper
.interpretProperties(properties
, bundlesToStart
,
56 systemPropertiesToAppend
);
57 ILaunchConfigurationWorkingCopy wc
= configuration
.getWorkingCopy();
58 OsgiLaunchHelper
.updateLaunchConfiguration(wc
, bundlesToStart
,
59 systemPropertiesToAppend
, null);
62 super.preLaunchCheck(configuration
, launch
, monitor
);