List of usage examples for org.eclipse.jdt.internal.core ClasspathEntry rootID
String rootID
To view the source code for org.eclipse.jdt.internal.core ClasspathEntry rootID.
Click Source Link
From source file:org.eclipse.jdt.internal.core.JavaProject.java
License:Open Source License
/** * Internal computation of an expanded classpath. It will eliminate duplicates, and produce copies * of exported or restricted classpath entries to avoid possible side-effects ever after. *///from w w w.j av a 2 s . c om private void computeExpandedClasspath(ClasspathEntry referringEntry, HashSet rootIDs, ObjectVector accumulatedEntries) throws JavaModelException { String projectRootId = rootID(); if (rootIDs.contains(projectRootId)) { return; // break cycles if any } rootIDs.add(projectRootId); IClasspathEntry[] resolvedClasspath = getResolvedClasspath(); IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); boolean isInitialProject = referringEntry == null; for (int i = 0, length = resolvedClasspath.length; i < length; i++) { ClasspathEntry entry = (ClasspathEntry) resolvedClasspath[i]; if (isInitialProject || entry.isExported()) { String rootID = entry.rootID(); if (rootIDs.contains(rootID)) { continue; } // combine restrictions along the project chain ClasspathEntry combinedEntry = entry.combineWith(referringEntry); accumulatedEntries.add(combinedEntry); // recurse in project to get all its indirect exports (only consider exported entries from there on) if (entry.getEntryKind() == IClasspathEntry.CPE_PROJECT) { IResource member = workspaceRoot.findMember(entry.getPath()); if (member != null && member.getType() == IResource.PROJECT) { // double check if bound to project (23977) IProject projRsc = (IProject) member; if (JavaProject.hasJavaNature(projRsc)) { JavaProject javaProject = (JavaProject) JavaCore.create(projRsc); javaProject.computeExpandedClasspath(combinedEntry, rootIDs, accumulatedEntries); } } } else { rootIDs.add(rootID); } } } }