1 11 12 package org.eclipse.jdt.internal.junit.launcher; 13 14 import org.eclipse.core.runtime.CoreException; 15 16 import org.eclipse.core.resources.ResourcesPlugin; 17 18 import org.eclipse.debug.core.ILaunchConfiguration; 19 20 import org.eclipse.jdt.core.IJavaProject; 21 import org.eclipse.jdt.core.JavaCore; 22 23 import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; 24 25 import org.eclipse.jdt.internal.junit.ui.JUnitPlugin; 26 27 31 public class JUnitLaunchConfigurationConstants { 32 33 public static final String MODE_RUN_QUIETLY_MODE = "runQuietly"; public static final String ID_JUNIT_APPLICATION= "org.eclipse.jdt.junit.launchconfig"; 36 public static final String ATTR_NO_DISPLAY = JUnitPlugin.PLUGIN_ID + ".NO_DISPLAY"; 38 39 40 public static final String ATTR_PORT= JUnitPlugin.PLUGIN_ID+".PORT"; 42 45 public static final String ATTR_TEST_METHOD_NAME= JUnitPlugin.PLUGIN_ID+".TESTNAME"; 47 public static final String ATTR_KEEPRUNNING = JUnitPlugin.PLUGIN_ID+ ".KEEPRUNNING_ATTR"; 51 public static final String ATTR_TEST_CONTAINER= JUnitPlugin.PLUGIN_ID+".CONTAINER"; 53 public static final String ATTR_FAILURES_NAMES= JUnitPlugin.PLUGIN_ID+".FAILURENAMES"; 55 public static final String ATTR_TEST_RUNNER_KIND= JUnitPlugin.PLUGIN_ID+".TEST_KIND"; 57 public static ITestKind getTestRunnerKind(ILaunchConfiguration launchConfiguration) { 58 try { 59 String loaderId = launchConfiguration.getAttribute(JUnitLaunchConfigurationConstants.ATTR_TEST_RUNNER_KIND, (String ) null); 60 if (loaderId != null) { 61 return TestKindRegistry.getDefault().getKind(loaderId); 62 } 63 } catch (CoreException e) { 64 } 65 return ITestKind.NULL; 66 } 67 68 public static IJavaProject getJavaProject(ILaunchConfiguration configuration) { 69 try { 70 String projectName= configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String ) null); 71 if (projectName != null && projectName.length() > 0) { 72 return JavaCore.create(ResourcesPlugin.getWorkspace().getRoot().getProject(projectName)); 73 } 74 } catch (CoreException e) { 75 } 76 return null; 77 } 78 79 80 } 81 | Popular Tags |