Package org.eclipse.jdt.junit.launcher
Class JUnitLaunchShortcut
java.lang.Object
org.eclipse.jdt.junit.launcher.JUnitLaunchShortcut
- All Implemented Interfaces:
org.eclipse.debug.ui.ILaunchShortcut
,org.eclipse.debug.ui.ILaunchShortcut2
The launch shortcut to launch JUnit tests.
This class may be instantiated and subclassed.
- Since:
- 3.3
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected org.eclipse.debug.core.ILaunchConfigurationWorkingCopy
createLaunchConfiguration
(IJavaElement element) Creates a launch configuration working copy for the given element.protected org.eclipse.debug.core.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.org.eclipse.core.resources.IResource
getLaunchableResource
(org.eclipse.jface.viewers.ISelection selection) org.eclipse.core.resources.IResource
getLaunchableResource
(org.eclipse.ui.IEditorPart editor) org.eclipse.debug.core.ILaunchConfiguration[]
getLaunchConfigurations
(org.eclipse.jface.viewers.ISelection selection) org.eclipse.debug.core.ILaunchConfiguration[]
getLaunchConfigurations
(org.eclipse.ui.IEditorPart editor) protected String
Returns the launch configuration type id of the launch configuration this shortcut will create.void
void
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 interfaceorg.eclipse.debug.ui.ILaunchShortcut
-
launch
- Specified by:
launch
in interfaceorg.eclipse.debug.ui.ILaunchShortcut
-
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 org.eclipse.debug.core.ILaunchConfigurationWorkingCopy createLaunchConfiguration(IJavaElement element) throws org.eclipse.core.runtime.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:
org.eclipse.core.runtime.CoreException
- if creation failed
-
createLaunchConfiguration
protected org.eclipse.debug.core.ILaunchConfigurationWorkingCopy createLaunchConfiguration(IJavaElement element, String testName) throws org.eclipse.core.runtime.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:
org.eclipse.core.runtime.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
public org.eclipse.debug.core.ILaunchConfiguration[] getLaunchConfigurations(org.eclipse.jface.viewers.ISelection selection) - Specified by:
getLaunchConfigurations
in interfaceorg.eclipse.debug.ui.ILaunchShortcut2
- Since:
- 3.4
-
getLaunchConfigurations
public org.eclipse.debug.core.ILaunchConfiguration[] getLaunchConfigurations(org.eclipse.ui.IEditorPart editor) - Specified by:
getLaunchConfigurations
in interfaceorg.eclipse.debug.ui.ILaunchShortcut2
- Since:
- 3.4
-
getLaunchableResource
public org.eclipse.core.resources.IResource getLaunchableResource(org.eclipse.jface.viewers.ISelection selection) - Specified by:
getLaunchableResource
in interfaceorg.eclipse.debug.ui.ILaunchShortcut2
- Since:
- 3.4
-
getLaunchableResource
public org.eclipse.core.resources.IResource getLaunchableResource(org.eclipse.ui.IEditorPart editor) - Specified by:
getLaunchableResource
in interfaceorg.eclipse.debug.ui.ILaunchShortcut2
- Since:
- 3.4
-