mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-11 10:15:39 +02:00
Fix for bug 60491
Added working copy filtering to search engine From now on only relevent working copies are considered for search If no index paths are found then search will return no results regardless of any working copies passed in
This commit is contained in:
parent
0f10e95c21
commit
649504b424
3 changed files with 41 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
|||
2004-05-14 Bogdan Gheorghe
|
||||
bug 60491
|
||||
Added working copy filtering to search engine
|
||||
From now on only relevent working copies are considered for search
|
||||
If no index paths are found then search will return no results regardless of any working copies passed in
|
||||
|
||||
2004-05-14 Andrew Niefer
|
||||
bug 56411 - Added IndexingJob show that indexing shows up in the process view
|
||||
- this allows for the index job to be cancelled, which pauses indexing until someone requests something
|
||||
|
|
|
@ -210,8 +210,10 @@ public class SearchEngine implements ICSearchConstants{
|
|||
if( progressMonitor != null )
|
||||
progressMonitor.subTask( Util.bind( "engine.searching" ) );
|
||||
|
||||
//TODO: BOG Filter Working Copies...
|
||||
matchLocator.locateMatches( pathCollector.getPaths(), workspace, this.workingCopies, matches);
|
||||
String[] indexerPaths = pathCollector.getPaths();
|
||||
pathCollector = null; // release
|
||||
|
||||
matchLocator.locateMatches( indexerPaths, workspace, filterWorkingCopies(this.workingCopies, scope), matches);
|
||||
} finally {
|
||||
AcceptMatchOperation acceptMatchOp = new AcceptMatchOperation(collector, matches);
|
||||
try {
|
||||
|
@ -219,4 +221,31 @@ public class SearchEngine implements ICSearchConstants{
|
|||
} catch (CoreException e) {}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param copies
|
||||
* @param scope
|
||||
* @return
|
||||
*/
|
||||
private IWorkingCopy[] filterWorkingCopies(IWorkingCopy[] copies, ICSearchScope scope) {
|
||||
|
||||
if (copies == null ||
|
||||
copies.length == 0)
|
||||
return copies;
|
||||
|
||||
int length = copies.length;
|
||||
IWorkingCopy[] results= new IWorkingCopy[length];
|
||||
int index=0;
|
||||
|
||||
for (int i=0;i<length;i++){
|
||||
IWorkingCopy workingCopy = copies[i];
|
||||
if(scope.encloses(workingCopy.getPath().toOSString())){
|
||||
results[index++]=workingCopy;
|
||||
}
|
||||
}
|
||||
|
||||
System.arraycopy(results,0,results= new IWorkingCopy[index],0,index);
|
||||
|
||||
return results;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -344,6 +344,10 @@ public class MatchLocator implements IMatchLocator{
|
|||
|
||||
|
||||
public void locateMatches( String [] paths, IWorkspace workspace, IWorkingCopy[] workingCopies,ArrayList matches ) throws InterruptedException{
|
||||
|
||||
if (!(paths.length > 0))
|
||||
return;
|
||||
|
||||
matchStorage = matches;
|
||||
workspaceRoot = (workspace != null) ? workspace.getRoot() : null;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue