/** * Constructs an empty source locator. */ public JavaUISourceLocator() { fSourceLocator = new JavaSourceLocator(); fAllowedToAsk = true; }
/** * Constructs a new source locator that looks in the * specified project for source, and required projects, if * <code>includeRequired</code> is <code>true</code>. * * @param projects the projects in which to look for source * @param includeRequired whether to look in required projects * as well */ public JavaUISourceLocator( IJavaProject[] projects, boolean includeRequired) throws JavaModelException { fSourceLocator = new JavaSourceLocator(projects, includeRequired); fAllowedToAsk = true; }
/** * Constructs a source locator that searches for source * in the given Java project, and all of its required projects, * as specified by its build path or default source lookup * settings. * * @param project Java project * @exception CoreException if unable to read the project's * build path */ public JavaUISourceLocator(IJavaProject project) throws CoreException { fJavaProject = project; IJavaSourceLocation[] sls = JavaSourceLocator.getDefaultSourceLocations(project); fSourceLocator = new JavaSourceLocator(project); if (sls != null) { fSourceLocator.setSourceLocations(sls); } fAllowedToAsk = true; }
/** * Returns a default collection of source locations for * the given Java project. Default source locations consist * of the given project and all of its required projects . * * @param project Java project * @return a collection of source locations for all required * projects * @exception CoreException if an exception occurs reading * computing the default locations */ public static IJavaSourceLocation[] getDefaultSourceLocations(IJavaProject project) throws CoreException { // create a temporary launch config ILaunchConfigurationType type = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION); ILaunchConfigurationWorkingCopy config = type.newInstance(null, project.getElementName()); config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, project.getElementName()); JavaSourceLocator locator = new JavaSourceLocator(); locator.initializeDefaults(config); return locator.getSourceLocations(); }
/** * Returns a default collection of source locations for * the given Java project. Default source locations consist * of the given project and all of its required projects . * * @param project Java project * @return a collection of source locations for all required * projects * @exception CoreException if an exception occurs reading * computing the default locations */ public static IJavaSourceLocation[] getDefaultSourceLocations(IJavaProject project) throws CoreException { // create a temporary launch config ILaunchConfigurationType type = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION); ILaunchConfigurationWorkingCopy config = type.newInstance(null, project.getElementName()); config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, project.getElementName()); JavaSourceLocator locator = new JavaSourceLocator(); locator.initializeDefaults(config); return locator.getSourceLocations(); }