# Class AbstractLaunchShortcut

java.lang.Object
org.eclipse.pde.ui.launcher.AbstractLaunchShortcut

All Implemented Interfaces:
  `ILaunchShortcut`

Direct Known Subclasses:
  `EclipseLaunchShortcut, OSGiLaunchShortcut`

public abstract class AbstractLaunchShortcut extends Object implements ILaunchShortcut
An abstract class subclassed by the Eclipse Application and OSGi Framework launch shortcuts.

This class may be subclassed by clients.

Since:
  3.3

## Constructor Summary

Constructors
Constructor
Description
`AbstractLaunchShortcut()`

## Method Summary

Modifier and Type
Method
Description
`protected ILaunchConfiguration`
`chooseConfiguration(ILaunchConfiguration[] configs, String mode)`
Display to the user a list of matching existing launch configurations and return the user's selection.
`protected ILaunchConfiguration`
`findLaunchConfiguration(String mode)`
This method first tries to locate existing launch configurations that are suitable for the application or framework being launched.
`protected abstract String`
`getLaunchConfigurationTypeName()`
Returns the launch configuration type name.
`protected String`
`getName(ILaunchConfigurationType type)`
Returns the name assigned to the new launch configuration
`protected abstract void`
`initializeConfiguration(ILaunchConfigurationWorkingCopy wc)`
Initialize launch attributes on the new launch configuration.
`protected abstract boolean`
`isGoodMatch(ILaunchConfiguration configuration)`
Determines whether a given launch configuration is a good match given the current application or framework being launched.
`protected void`
`launch(String mode)`
Launches the application in the specified mode, or does nothing if the user canceled the launch when offered to select one of several available launch configurations.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface ILaunchShortcut

`launch, launch`

## Constructor Details

### AbstractLaunchShortcut

public AbstractLaunchShortcut()

## Method Details

### launch

protected void launch(String mode)
Launches the application in the specified mode, or does nothing if the user canceled the launch when offered to select one of several available launch configurations.

Parameters:
  `mode` - mode of launch (run, debug or profile)
See Also:
  - `ILaunchManager`

### findLaunchConfiguration

protected ILaunchConfiguration findLaunchConfiguration(String mode)
This method first tries to locate existing launch configurations that are suitable for the application or framework being launched.

- If none are found, a new launch configuration is created and initialized
- If one is found, it is launched automatically
- If more than one is found, a selection dialog is presented to the user and the chosen one will be launched

Parameters:
  `mode` - mode of launch (run, debug or profile)
Returns:
  a launch configuration to run or `null` if launch is canceled

### chooseConfiguration

protected ILaunchConfiguration chooseConfiguration(ILaunchConfiguration[] configs, String mode)
Display to the user a list of matching existing launch configurations and return the user's selection.

Parameters:
  `configs` - an array of matching existing launch configurations
  `mode` - mode of launch
Returns:
  the launch configuration selected by the user or `null` if Cancel was pressed

### getName

protected String getName(ILaunchConfigurationType type)
Returns the name assigned to the new launch configuration

Returns:
  a name for the new launch configuration

### initializeConfiguration

protected abstract void initializeConfiguration(ILaunchConfigurationWorkingCopy wc)
Initialize launch attributes on the new launch configuration. Must be overridden by subclasses.

Parameters:
  `wc` - the launch configuration working copy to be initialize
See Also:
  - `IPDELauncherConstants`

### getLaunchConfigurationTypeName

protected abstract String getLaunchConfigurationTypeName()
Returns the launch configuration type name. Must be overridden by subclasses

Returns:
  the launch configuration type name

### isGoodMatch

protected abstract boolean isGoodMatch(ILaunchConfiguration configuration)
Determines whether a given launch configuration is a good match given the current application or framework being launched. This method must be overridden by subclasses. Its purpose is to add criteria on what makes a good match or not.

Parameters:
  `configuration` - the launch configuration being evaluated
Returns:
  `true` if the launch configuration is a good match for the application or framework being launched, `false` otherwise.