mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
ResourceLookup does not limit result to the provided projects, bug 249806.
This commit is contained in:
parent
71910194db
commit
21b5326fac
1 changed files with 19 additions and 3 deletions
|
@ -670,13 +670,17 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
|
||||||
while(suffix.startsWith("../")) { //$NON-NLS-1$
|
while(suffix.startsWith("../")) { //$NON-NLS-1$
|
||||||
suffix= suffix.substring(3);
|
suffix= suffix.substring(3);
|
||||||
}
|
}
|
||||||
return extractMatchesForName(candidates, name, suffix, ignoreCase);
|
Set<String> prjset= new HashSet<String>();
|
||||||
|
for (IProject prj : projects) {
|
||||||
|
prjset.add(prj.getName());
|
||||||
|
}
|
||||||
|
return extractMatchesForName(candidates, name, suffix, ignoreCase, prjset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selects the actual matches for the list of candidate nodes.
|
* Selects the actual matches for the list of candidate nodes.
|
||||||
*/
|
*/
|
||||||
private IFile[] extractMatchesForName(Node[] candidates, String name, String suffix, boolean ignoreCase) {
|
private IFile[] extractMatchesForName(Node[] candidates, String name, String suffix, boolean ignoreCase, Set<String> prjSet) {
|
||||||
final char[] n1= name.toCharArray();
|
final char[] n1= name.toCharArray();
|
||||||
final int namelen = n1.length;
|
final int namelen = n1.length;
|
||||||
int resultIdx= 0;
|
int resultIdx= 0;
|
||||||
|
@ -691,7 +695,7 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
|
||||||
IFile[] result= null;
|
IFile[] result= null;
|
||||||
outer: for (int i = 0; i < candidates.length; i++) {
|
outer: for (int i = 0; i < candidates.length; i++) {
|
||||||
final Node node = candidates[i];
|
final Node node = candidates[i];
|
||||||
if (!node.fIsFolder) {
|
if (!node.fIsFolder && checkProject(node, prjSet)) {
|
||||||
final char[] n2= node.fResourceName;
|
final char[] n2= node.fResourceName;
|
||||||
if (namelen == n2.length) {
|
if (namelen == n2.length) {
|
||||||
for (int j = 0; j < n2.length; j++) {
|
for (int j = 0; j < n2.length; j++) {
|
||||||
|
@ -725,6 +729,18 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean checkProject(Node node, Set<String> prjSet) {
|
||||||
|
while(true) {
|
||||||
|
final Node n= node.fParent;
|
||||||
|
if (n == fRootNode)
|
||||||
|
break;
|
||||||
|
if (n == null)
|
||||||
|
return false;
|
||||||
|
node= n;
|
||||||
|
}
|
||||||
|
return prjSet.contains(new String(node.fResourceName));
|
||||||
|
}
|
||||||
|
|
||||||
private IPath createPath(Node node) {
|
private IPath createPath(Node node) {
|
||||||
if (node == fRootNode)
|
if (node == fRootNode)
|
||||||
return Path.ROOT;
|
return Path.ROOT;
|
||||||
|
|
Loading…
Add table
Reference in a new issue