public String[] getClasspath(ILaunchConfiguration configuration) throws CoreException { String[] cp= super.getClasspath(configuration); ITestKind kind= getTestRunnerKind(configuration); List junitEntries = new ClasspathLocalizer(Platform.inDevelopmentMode()).localizeClasspath(kind); String[] classPath= new String[cp.length + junitEntries.size()]; Object[] jea= junitEntries.toArray(); System.arraycopy(cp, 0, classPath, 0, cp.length); System.arraycopy(jea, 0, classPath, cp.length, jea.length); return classPath; }
/** * Verifies a main type name is specified by the given launch configuration, * and returns the main type name. * * @param configuration * launch configuration * @return the main type name specified by the given launch configuration * @exception CoreException * if unable to retrieve the attribute or the attribute is * unspecified */ public String verifyMainTypeName(ILaunchConfiguration configuration) throws CoreException { String name = getMainTypeName(configuration); if (name == null) { abort( LaunchingMessages.AbstractJavaLaunchConfigurationDelegate_Main_type_not_specified_11, null, IJavaLaunchConfigurationConstants.ERR_UNSPECIFIED_MAIN_TYPE); } return name; } /**
attributes.putAll(map); String[][] paths = getBootpathExt(configuration); String[] pre = paths[0]; String[] boot = paths[1];
/** * Verifies a Java project is specified by the given launch configuration, * and returns the Java project. * * @param configuration * launch configuration * @return the Java project specified by the given launch configuration * @exception CoreException * if unable to retrieve the attribute or the attribute is * unspecified */ public IJavaProject verifyJavaProject(ILaunchConfiguration configuration) throws CoreException { String name = getJavaProjectName(configuration); if (name == null) { abort( LaunchingMessages.AbstractJavaLaunchConfigurationDelegate_Java_project_not_specified_9, null, IJavaLaunchConfigurationConstants.ERR_UNSPECIFIED_PROJECT); } IJavaProject project = getJavaProject(configuration); if (project == null) { abort( LaunchingMessages.AbstractJavaLaunchConfigurationDelegate_Project_does_not_exist_or_is_not_a_Java_project_10, null, IJavaLaunchConfigurationConstants.ERR_NOT_A_JAVA_PROJECT); } return project; } /**
/** * Returns the VM runner for the given launch mode to use when launching the * given configuration. * * @param configuration launch configuration * @param mode launch node * @return VM runner to use when launching the given configuration in the given mode * @throws CoreException if a VM runner cannot be determined * @since 3.1 */ public IVMRunner getVMRunner(ILaunchConfiguration configuration, String mode) throws CoreException { IVMInstall vm = verifyVMInstall(configuration); IVMRunner runner = vm.getVMRunner(mode); if (runner == null) { abort(NLS.bind(LaunchingMessages.JavaLocalApplicationLaunchConfigurationDelegate_0, new String[]{vm.getName(), mode}), null, IJavaLaunchConfigurationConstants.ERR_VM_RUNNER_DOES_NOT_EXIST); } return runner; }
IPath path = getWorkingDirectoryPath(configuration); if (path == null) { File dir = getDefaultWorkingDirectory(configuration); if (dir != null) { if (!dir.isDirectory()) { abort( NLS.bind( LaunchingMessages.AbstractJavaLaunchConfigurationDelegate_Working_directory_does_not_exist___0__12, return res.getLocation().toFile(); abort( NLS.bind( LaunchingMessages.AbstractJavaLaunchConfigurationDelegate_Working_directory_does_not_exist___0__12, return res.getLocation().toFile(); abort( NLS.bind( LaunchingMessages.AbstractJavaLaunchConfigurationDelegate_Working_directory_does_not_exist___0__12,
if (configuration != null) { try { if (isStopInMain(configuration)) { String mainType = getMainTypeName(configuration); if (mainType != null) { Map<String, Object> map = new HashMap<String, Object>();
IVMInstall vm = getVMInstall(configuration); if (vm == null) { abort( LaunchingMessages.AbstractJavaLaunchConfigurationDelegate_The_specified_JRE_installation_does_not_exist_4, null, abort( NLS.bind(LaunchingMessages.AbstractJavaLaunchConfigurationDelegate_JRE_home_directory_not_specified_for__0__5, new String[]{vm.getName()}), null, abort( NLS.bind(LaunchingMessages.AbstractJavaLaunchConfigurationDelegate_JRE_home_directory_for__0__does_not_exist___1__6, new String[]{vm.getName(),
IVMInstall install = getVMInstall(configuration); LibraryLocation[] libraryLocations = install.getLibraryLocations(); if (libraryLocations != null) { jreEntry.getPath(), IRuntimeClasspathEntry.BOOTSTRAP_CLASSES, getJavaProject(configuration)); bootEntries = JavaRuntime.resolveRuntimeClasspathEntry(bootEntry, configuration); } else {
/** * Returns an array of paths to be used for the <code>java.library.path</code> * system property, or <code>null</code> if unspecified. * * @param configuration the config * @return an array of paths to be used for the <code>java.library.path</code> * system property, or <code>null</code> * @throws CoreException if unable to determine the attribute * @since 3.1 */ public String[] getJavaLibraryPath(ILaunchConfiguration configuration) throws CoreException { IJavaProject project = getJavaProject(configuration); if (project != null) { String[] paths = JavaRuntime.computeJavaLibraryPath(project, true); if (paths.length > 0) { return paths; } } return null; }
/** * Returns the main type name specified by the given launch configuration, or <code>null</code> if none. * * @param configuration * launch configuration * @return the main type name specified by the given launch configuration, or <code>null</code> if none * @exception CoreException * if unable to retrieve the attribute */ public static String getMainTypeName(ILaunchConfiguration configuration) throws CoreException { return fgDelegate.getMainTypeName(configuration); } }
@Override public boolean preLaunchCheck(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException { // build project list if (monitor != null) { monitor.subTask(LaunchingMessages.AbstractJavaLaunchConfigurationDelegate_20); } fOrderedProjects = null; IJavaProject javaProject = JavaRuntime.getJavaProject(configuration); if (javaProject != null) { fOrderedProjects = computeReferencedBuildOrder(new IProject[]{javaProject .getProject()}); } // do generic launch checks return super.preLaunchCheck(configuration, mode, monitor); }
/** * Assigns a default source locator to the given launch if a source locator * has not yet been assigned to it, and the associated launch configuration * does not specify a source locator. * * @param launch * launch object * @param configuration * configuration being launched * @exception CoreException * if unable to set the source locator */ protected void setDefaultSourceLocator(ILaunch launch, ILaunchConfiguration configuration) throws CoreException { // set default source locator if none specified if (launch.getSourceLocator() == null) { ISourceLookupDirector sourceLocator = new JavaSourceLookupDirector(); sourceLocator .setSourcePathComputer(getLaunchManager() .getSourcePathComputer( "org.eclipse.jdt.launching.sourceLookup.javaSourcePathComputer")); //$NON-NLS-1$ sourceLocator.initializeDefaults(configuration); launch.setSourceLocator(sourceLocator); } } /**
/** * Returns the Java project specified by the given launch configuration, or * <code>null</code> if none. * * @param configuration * launch configuration * @return the Java project specified by the given launch configuration, or * <code>null</code> if none * @exception CoreException * if unable to retrieve the attribute */ public IJavaProject getJavaProject(ILaunchConfiguration configuration) throws CoreException { String projectName = getJavaProjectName(configuration); if (projectName != null) { projectName = projectName.trim(); if (projectName.length() > 0) { IProject project = ResourcesPlugin.getWorkspace().getRoot() .getProject(projectName); IJavaProject javaProject = JavaCore.create(project); if (javaProject != null && javaProject.exists()) { return javaProject; } } } return null; } /**
if (libraryPath < 0) { String[] javaLibraryPath = getJavaLibraryPath(configuration); if (javaLibraryPath != null && javaLibraryPath.length > 0) { StringBuffer path = new StringBuffer(args);
/** * Verifies a Java project is specified by the given launch configuration, * and returns the Java project. * * @param configuration * launch configuration * @return the Java project specified by the given launch configuration * @exception CoreException * if unable to retrieve the attribute or the attribute is * unspecified */ public IJavaProject verifyJavaProject(ILaunchConfiguration configuration) throws CoreException { String name = getJavaProjectName(configuration); if (name == null) { abort( LaunchingMessages.AbstractJavaLaunchConfigurationDelegate_Java_project_not_specified_9, null, IJavaLaunchConfigurationConstants.ERR_UNSPECIFIED_PROJECT); } IJavaProject project = getJavaProject(configuration); if (project == null) { abort( LaunchingMessages.AbstractJavaLaunchConfigurationDelegate_Project_does_not_exist_or_is_not_a_Java_project_10, null, IJavaLaunchConfigurationConstants.ERR_NOT_A_JAVA_PROJECT); } return project; } /**
IPath path = getWorkingDirectoryPath(configuration); if (path == null) { File dir = getDefaultWorkingDirectory(configuration); if (dir != null) { if (!dir.isDirectory()) { abort( NLS.bind( LaunchingMessages.AbstractJavaLaunchConfigurationDelegate_Working_directory_does_not_exist___0__12, return res.getLocation().toFile(); abort( NLS.bind( LaunchingMessages.AbstractJavaLaunchConfigurationDelegate_Working_directory_does_not_exist___0__12, return res.getLocation().toFile(); abort( NLS.bind( LaunchingMessages.AbstractJavaLaunchConfigurationDelegate_Working_directory_does_not_exist___0__12,
if (configuration != null) { try { if (isStopInMain(configuration)) { String mainType = getMainTypeName(configuration); if (mainType != null) { Map<String, Object> map = new HashMap<>();
/** * Returns the VM runner for the given launch mode to use when launching the * given configuration. * * @param configuration launch configuration * @param mode launch node * @return VM runner to use when launching the given configuration in the given mode * @throws CoreException if a VM runner cannot be determined * @since 3.1 */ public IVMRunner getVMRunner(ILaunchConfiguration configuration, String mode) throws CoreException { IVMInstall vm = verifyVMInstall(configuration); IVMRunner runner = vm.getVMRunner(mode); if (runner == null) { abort(NLS.bind(LaunchingMessages.JavaLocalApplicationLaunchConfigurationDelegate_0, new String[]{vm.getName(), mode}), null, IJavaLaunchConfigurationConstants.ERR_VM_RUNNER_DOES_NOT_EXIST); } return runner; }
IVMInstall vm = getVMInstall(configuration); if (vm == null) { abort( LaunchingMessages.AbstractJavaLaunchConfigurationDelegate_The_specified_JRE_installation_does_not_exist_4, null, abort( NLS.bind(LaunchingMessages.AbstractJavaLaunchConfigurationDelegate_JRE_home_directory_not_specified_for__0__5, new String[]{vm.getName()}), null, abort( NLS.bind(LaunchingMessages.AbstractJavaLaunchConfigurationDelegate_JRE_home_directory_for__0__does_not_exist___1__6, new String[]{vm.getName(),