/** * 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; } /**
/** * 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; } /**
/** * 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; } /**
/** * 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; } /**