1 package org
.argeo
.slc
.ide
.ui
.launch
.osgi
;
3 import java
.util
.Iterator
;
5 import org
.eclipse
.core
.resources
.IFile
;
6 import org
.eclipse
.core
.resources
.IResource
;
7 import org
.eclipse
.debug
.core
.DebugPlugin
;
8 import org
.eclipse
.debug
.core
.ILaunchConfiguration
;
9 import org
.eclipse
.debug
.core
.ILaunchConfigurationType
;
10 import org
.eclipse
.debug
.core
.ILaunchConfigurationWorkingCopy
;
11 import org
.eclipse
.jdt
.launching
.IJavaLaunchConfigurationConstants
;
12 import org
.eclipse
.jface
.viewers
.ISelection
;
13 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
14 import org
.eclipse
.pde
.ui
.launcher
.EclipseLaunchShortcut
;
17 * Launch shortcut simplifying the launch of an Eclipse application (typically
20 public class EclipseBootLaunchShortcut
extends EclipseLaunchShortcut
implements
21 OsgiLauncherConstants
{
22 private StringBuffer name
= null;
23 private IFile propertiesFile
= null;
26 protected String
getLaunchConfigurationTypeName() {
27 return EclipseBootLaunchConfiguration
.ID
;
31 public void launch(ISelection selection
, String mode
) {
32 // we assume that only one file is selected
33 IStructuredSelection sSelection
= (IStructuredSelection
) selection
;
34 Iterator
<?
> it
= sSelection
.iterator();
35 propertiesFile
= (IFile
) it
.next();
37 name
= new StringBuffer(OsgiLaunchHelper
.extractName(propertiesFile
));
39 super.launch(selection
, mode
);
43 protected void initializeConfiguration(ILaunchConfigurationWorkingCopy wc
) {
44 IResource
[] resources
= { propertiesFile
};
45 wc
.setMappedResources(resources
);
46 super.initializeConfiguration(wc
);
48 OsgiLaunchHelper
.setDefaults(wc
, true);
50 IJavaLaunchConfigurationConstants
.ATTR_WORKING_DIRECTORY
,
51 OsgiLaunchHelper
.findWorkingDirectory(propertiesFile
));
53 OsgiLaunchHelper
.updateLaunchConfiguration(wc
, true);
56 protected String
getName(ILaunchConfigurationType type
) {
57 if (name
!= null && !name
.toString().trim().equals(""))
58 return DebugPlugin
.getDefault().getLaunchManager()
59 .generateLaunchConfigurationName(name
.toString());
61 return DebugPlugin
.getDefault().getLaunchManager()
62 .generateLaunchConfigurationName("SLC");
66 protected boolean isGoodMatch(ILaunchConfiguration configuration
) {
68 return name
.toString().equals(configuration
.getName());
70 return super.isGoodMatch(configuration
);