for (int i= 0; i < projects.length; i++) { if (includeRequired) { collectRequiredProjects(projects[i], requiredProjects); } else { if (!requiredProjects.contains(projects[i])) {
for (int i= 0; i < projects.length; i++) { if (includeRequired) { collectRequiredProjects(projects[i], requiredProjects); } else { if (!requiredProjects.contains(projects[i])) {
/** * Adds all projects required by <code>proj</code> to the list * <code>res</code> * * @param proj the project for which to compute required * projects * @param res the list to add all required projects too * @throws JavaModelException if there is a problem with the backing Java model */ protected static void collectRequiredProjects(IJavaProject proj, ArrayList<IJavaProject> res) throws JavaModelException { if (!res.contains(proj)) { res.add(proj); IJavaModel model= proj.getJavaModel(); IClasspathEntry[] entries= proj.getRawClasspath(); for (int i= 0; i < entries.length; i++) { IClasspathEntry curr= entries[i]; if (curr.getEntryKind() == IClasspathEntry.CPE_PROJECT) { IJavaProject ref= model.getJavaProject(curr.getPath().segment(0)); if (ref.exists()) { collectRequiredProjects(ref, res); } } } } }
/** * Adds all projects required by <code>proj</code> to the list * <code>res</code> * * @param proj the project for which to compute required * projects * @param res the list to add all required projects too * @throws JavaModelException if there is a problem with the backing Java model */ protected static void collectRequiredProjects(IJavaProject proj, ArrayList<IJavaProject> res) throws JavaModelException { if (!res.contains(proj)) { res.add(proj); IJavaModel model= proj.getJavaModel(); IClasspathEntry[] entries= proj.getRawClasspath(); for (int i= 0; i < entries.length; i++) { IClasspathEntry curr= entries[i]; if (curr.getEntryKind() == IClasspathEntry.CPE_PROJECT) { IJavaProject ref= model.getJavaProject(curr.getPath().segment(0)); if (ref.exists()) { collectRequiredProjects(ref, res); } } } } }