Skip to content

Commit

Permalink
205: simplified enum switch
Browse files Browse the repository at this point in the history
the default case is the one for java project and fragments

Task-Url: #205
  • Loading branch information
LorenzoBettini committed Aug 25, 2022
1 parent 5184f4a commit beb2bb9
Showing 1 changed file with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,6 @@ protected ILaunchConfigurationWorkingCopy createLaunchConfiguration(IJavaElement
final String containerHandleId;

switch (element.getElementType()) {
case JAVA_PROJECT:
case PACKAGE_FRAGMENT_ROOT:
case PACKAGE_FRAGMENT:
String name = getTextLabel(element, ALL_FULLY_QUALIFIED);
containerHandleId = element.getHandleIdentifier();
mainTypeQualifiedName = EMPTY_STRING;
testName = name.substring(name.lastIndexOf(IPath.SEPARATOR) + 1);
break;
case TYPE:
containerHandleId = EMPTY_STRING;
// don't replace, fix for binary inner types
Expand All @@ -208,8 +200,11 @@ protected ILaunchConfigurationWorkingCopy createLaunchConfiguration(IJavaElement
mainTypeQualifiedName = method.getDeclaringType().getFullyQualifiedName('.');
testName = method.getDeclaringType().getElementName() + '.' + method.getElementName();
break;
default:
throw new IllegalArgumentException("Invalid element type to create a launch configuration: " + element.getClass().getName()); //$NON-NLS-1$
default: // JAVA_PROJECT, PACKAGE_FRAGMENT_ROOT, PACKAGE_FRAGMENT
String name = getTextLabel(element, ALL_FULLY_QUALIFIED);
containerHandleId = element.getHandleIdentifier();
mainTypeQualifiedName = EMPTY_STRING;
testName = name.substring(name.lastIndexOf(IPath.SEPARATOR) + 1);
}

ILaunchConfigurationType configType = getLaunchManager().getLaunchConfigurationType(getLaunchConfigurationTypeId());
Expand Down

0 comments on commit beb2bb9

Please sign in to comment.