Lines 96-101
Link Here
|
96 |
import org.netbeans.api.java.queries.SourceForBinaryQuery; |
96 |
import org.netbeans.api.java.queries.SourceForBinaryQuery; |
97 |
import org.netbeans.api.java.source.ClasspathInfo.PathKind; |
97 |
import org.netbeans.api.java.source.ClasspathInfo.PathKind; |
98 |
import org.netbeans.api.java.source.JavaSource.Phase; |
98 |
import org.netbeans.api.java.source.JavaSource.Phase; |
|
|
99 |
import static org.netbeans.api.java.source.SourceUtils.getDependentRootsImpl; |
99 |
import org.netbeans.api.java.source.matching.Matcher; |
100 |
import org.netbeans.api.java.source.matching.Matcher; |
100 |
import org.netbeans.api.java.source.matching.Occurrence; |
101 |
import org.netbeans.api.java.source.matching.Occurrence; |
101 |
import org.netbeans.api.java.source.matching.Pattern; |
102 |
import org.netbeans.api.java.source.matching.Pattern; |
Lines 675-686
Link Here
|
675 |
public static Set<URL> getDependentRoots (final URL root) { |
676 |
public static Set<URL> getDependentRoots (final URL root) { |
676 |
final Map<URL, List<URL>> sourceDeps = IndexingController.getDefault().getRootDependencies(); |
677 |
final Map<URL, List<URL>> sourceDeps = IndexingController.getDefault().getRootDependencies(); |
677 |
final Map<URL, List<URL>> binaryDeps = IndexingController.getDefault().getBinaryRootDependencies(); |
678 |
final Map<URL, List<URL>> binaryDeps = IndexingController.getDefault().getBinaryRootDependencies(); |
678 |
return getDependentRootsImpl (root, sourceDeps, binaryDeps); |
679 |
return getDependentRootsImpl (root, sourceDeps, binaryDeps, true); |
679 |
} |
680 |
} |
680 |
|
681 |
|
|
|
682 |
/** |
683 |
* Returns the dependent source path roots for given source root. It returns |
684 |
* all the source roots which have either direct or transitive dependency on |
685 |
* the given source root. |
686 |
* |
687 |
* @param root to find the dependent roots for |
688 |
* @param filterNonOpenedProjects true if the results should only contain roots for |
689 |
* opened projects |
690 |
* @return {@link Set} of {@link URL}s containing at least the incoming |
691 |
* root, never returns null. |
692 |
* @since 0.110 |
693 |
*/ |
694 |
@org.netbeans.api.annotations.common.SuppressWarnings(value = {"DMI_COLLECTION_OF_URLS"}/*,justification="URLs have never host part"*/) //NOI18N |
695 |
public static Set<URL> getDependentRoots(final URL root, boolean filterNonOpenedProjects) { |
696 |
final Map<URL, List<URL>> sourceDeps = IndexingController.getDefault().getRootDependencies(); |
697 |
final Map<URL, List<URL>> binaryDeps = IndexingController.getDefault().getBinaryRootDependencies(); |
698 |
return getDependentRootsImpl(root, sourceDeps, binaryDeps, filterNonOpenedProjects); |
699 |
} |
681 |
|
700 |
|
682 |
@org.netbeans.api.annotations.common.SuppressWarnings(value={"DMI_COLLECTION_OF_URLS"}/*,justification="URLs have never host part"*/) //NOI18N |
701 |
@org.netbeans.api.annotations.common.SuppressWarnings(value={"DMI_COLLECTION_OF_URLS"}/*,justification="URLs have never host part"*/) //NOI18N |
683 |
static Set<URL> getDependentRootsImpl (final URL root, final Map<URL, List<URL>> sourceDeps, Map<URL, List<URL>> binaryDeps) { |
702 |
static Set<URL> getDependentRootsImpl (final URL root, final Map<URL, List<URL>> sourceDeps, Map<URL, List<URL>> binaryDeps, boolean filterNonOpenedProjects) { |
684 |
Set<URL> urls; |
703 |
Set<URL> urls; |
685 |
|
704 |
|
686 |
if (sourceDeps.containsKey(root)) { |
705 |
if (sourceDeps.containsKey(root)) { |
Lines 703-717
Link Here
|
703 |
} |
722 |
} |
704 |
} |
723 |
} |
705 |
|
724 |
|
706 |
//Filter non opened projects |
725 |
if(filterNonOpenedProjects) { |
707 |
Set<ClassPath> cps = GlobalPathRegistry.getDefault().getPaths(ClassPath.SOURCE); |
726 |
Set<ClassPath> cps = GlobalPathRegistry.getDefault().getPaths(ClassPath.SOURCE); |
708 |
Set<URL> toRetain = new HashSet<URL>(); |
727 |
Set<URL> toRetain = new HashSet<URL>(); |
709 |
for (ClassPath cp : cps) { |
728 |
for (ClassPath cp : cps) { |
710 |
for (ClassPath.Entry e : cp.entries()) { |
729 |
for (ClassPath.Entry e : cp.entries()) { |
711 |
toRetain.add(e.getURL()); |
730 |
toRetain.add(e.getURL()); |
|
|
731 |
} |
712 |
} |
732 |
} |
|
|
733 |
urls.retainAll(toRetain); |
713 |
} |
734 |
} |
714 |
urls.retainAll(toRetain); |
|
|
715 |
return urls; |
735 |
return urls; |
716 |
} |
736 |
} |
717 |
|
737 |
|