public class JUnitLaunchShortcut extends Object implements ILaunchShortcut2
This class may be instantiated and subclassed.
Constructor and Description |
---|
JUnitLaunchShortcut()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected 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[] |
getAttributeNamesToCompare()
Returns the attribute names of the attributes that are compared when looking for an existing
similar launch configuration.
|
IResource |
getLaunchableResource(IEditorPart editor) |
IResource |
getLaunchableResource(ISelection selection) |
ILaunchConfiguration[] |
getLaunchConfigurations(IEditorPart editor) |
ILaunchConfiguration[] |
getLaunchConfigurations(ISelection selection) |
protected String |
getLaunchConfigurationTypeId()
Returns the launch configuration type id of the launch configuration this shortcut will create.
|
void |
launch(IEditorPart editor,
String mode) |
void |
launch(ISelection selection,
String mode) |
protected String |
suggestLaunchConfigurationName(IJavaElement element,
String fullTestName)
Computes a human-readable name for a launch configuration.
|
public void launch(IEditorPart editor, String mode)
launch
in interface ILaunchShortcut
public void launch(ISelection selection, String mode)
launch
in interface ILaunchShortcut
protected String getLaunchConfigurationTypeId()
protected ILaunchConfigurationWorkingCopy createLaunchConfiguration(IJavaElement element) throws CoreException
getLaunchConfigurationTypeId()
. The
element type can only be of type IJavaProject
, IPackageFragmentRoot
,
IPackageFragment
, IType
or IMethod
.
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)
element
- element to launchCoreException
- if creation failedprotected ILaunchConfigurationWorkingCopy createLaunchConfiguration(IJavaElement element, String testName) throws CoreException
getLaunchConfigurationTypeId()
. The
element type can only be of type IJavaProject
, IPackageFragmentRoot
,
IPackageFragment
, IType
or IMethod
.
Clients can extend this method (should call super) to configure additional attributes on the launch configuration working copy.
element
- element to launchtestName
- name of the test to launch, e.g. the method name or an artificial name
created by a JUnit runner, or null
if none. The testName is
ignored if the element is an IMethod; the method name is used in that case.CoreException
- if creation failedprotected String suggestLaunchConfigurationName(IJavaElement element, String fullTestName)
element
- The Java Element that will be executed.fullTestName
- The test name. See
org.eclipse.jdt.internal.junit4.runner.DescriptionMatcher for supported formats.protected String[] getAttributeNamesToCompare()
public ILaunchConfiguration[] getLaunchConfigurations(ISelection selection)
getLaunchConfigurations
in interface ILaunchShortcut2
public ILaunchConfiguration[] getLaunchConfigurations(IEditorPart editor)
getLaunchConfigurations
in interface ILaunchShortcut2
public IResource getLaunchableResource(ISelection selection)
getLaunchableResource
in interface ILaunchShortcut2
public IResource getLaunchableResource(IEditorPart editor)
getLaunchableResource
in interface ILaunchShortcut2
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.