Package org.eclipse.jdt.junit.launcher
Class JUnitLaunchShortcut
java.lang.Object
org.eclipse.jdt.junit.launcher.JUnitLaunchShortcut
- All Implemented Interfaces:
ILaunchShortcut
,ILaunchShortcut2
The launch shortcut to launch JUnit tests.
This class may be instantiated and subclassed.
- Since:
- 3.3
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ILaunchConfigurationWorkingCopy
createLaunchConfiguration
(IJavaElement element) Creates a launch configuration working copy for the given element.protected ILaunchConfigurationWorkingCopy
createLaunchConfiguration
(IJavaElement element, String testName) Creates a launch configuration working copy for the given element.protected String[]
Returns the attribute names of the attributes that are compared when looking for an existing similar launch configuration.getLaunchableResource
(ISelection selection) getLaunchableResource
(IEditorPart editor) getLaunchConfigurations
(ISelection selection) getLaunchConfigurations
(IEditorPart editor) protected String
Returns the launch configuration type id of the launch configuration this shortcut will create.void
launch
(ISelection selection, String mode) void
launch
(IEditorPart editor, String mode) protected String
suggestLaunchConfigurationName
(IJavaElement element, String fullTestName) Computes a human-readable name for a launch configuration.
-
Constructor Details
-
JUnitLaunchShortcut
public JUnitLaunchShortcut()Default constructor.
-
-
Method Details
-
launch
- Specified by:
launch
in interfaceILaunchShortcut
-
launch
- Specified by:
launch
in interfaceILaunchShortcut
-
getLaunchConfigurationTypeId
Returns the launch configuration type id of the launch configuration this shortcut will create. Clients can override this method to return the id of their launch configuration.- Returns:
- the launch configuration type id of the launch configuration this shortcut will create
-
createLaunchConfiguration
protected ILaunchConfigurationWorkingCopy createLaunchConfiguration(IJavaElement element) throws CoreException Creates a launch configuration working copy for the given element. The launch configuration type created will be of the type returned bygetLaunchConfigurationTypeId()
. The element type can only be of typeIJavaProject
,IPackageFragmentRoot
,IPackageFragment
,IType
orIMethod
.Clients can extend this method (should call super) to configure additional attributes on the launch configuration working copy. Note that this method calls
. Extenders are recommended to extend the two-args method instead of this method.createLaunchConfiguration
(element, null)- Parameters:
element
- element to launch- Returns:
- a launch configuration working copy for the given element
- Throws:
CoreException
- if creation failed
-
createLaunchConfiguration
protected ILaunchConfigurationWorkingCopy createLaunchConfiguration(IJavaElement element, String testName) throws CoreException Creates a launch configuration working copy for the given element. The launch configuration type created will be of the type returned bygetLaunchConfigurationTypeId()
. The element type can only be of typeIJavaProject
,IPackageFragmentRoot
,IPackageFragment
,IType
orIMethod
.Clients can extend this method (should call super) to configure additional attributes on the launch configuration working copy.
- Parameters:
element
- element to launchtestName
- name of the test to launch, e.g. the method name or an artificial name created by a JUnit runner, ornull
if none. The testName is ignored if the element is an IMethod; the method name is used in that case.- Returns:
- a launch configuration working copy for the given element
- Throws:
CoreException
- if creation failed- Since:
- 3.8
-
suggestLaunchConfigurationName
Computes a human-readable name for a launch configuration. The name serves as a suggestion and it's the caller's responsibility to make it valid and unique.- Parameters:
element
- The Java Element that will be executed.fullTestName
- The test name. See org.eclipse.jdt.internal.junit4.runner.DescriptionMatcher for supported formats.- Returns:
- The suggested name for the launch configuration.
- Since:
- 3.8
-
getAttributeNamesToCompare
Returns the attribute names of the attributes that are compared when looking for an existing similar launch configuration. Clients can override and replace to customize.- Returns:
- the attribute names of the attributes that are compared
-
getLaunchConfigurations
- Specified by:
getLaunchConfigurations
in interfaceILaunchShortcut2
- Since:
- 3.4
-
getLaunchConfigurations
- Specified by:
getLaunchConfigurations
in interfaceILaunchShortcut2
- Since:
- 3.4
-
getLaunchableResource
- Specified by:
getLaunchableResource
in interfaceILaunchShortcut2
- Since:
- 3.4
-
getLaunchableResource
- Specified by:
getLaunchableResource
in interfaceILaunchShortcut2
- Since:
- 3.4
-