diff --git a/core/org.eclipse.cdt.core/search/ChangeLog b/core/org.eclipse.cdt.core/search/ChangeLog index 0381f36a5c0..ec3f121e06e 100644 --- a/core/org.eclipse.cdt.core/search/ChangeLog +++ b/core/org.eclipse.cdt.core/search/ChangeLog @@ -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 diff --git a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/SearchEngine.java b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/SearchEngine.java index 202898be132..eac01f7d00f 100644 --- a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/SearchEngine.java +++ b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/SearchEngine.java @@ -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 0)) + return; + matchStorage = matches; workspaceRoot = (workspace != null) ? workspace.getRoot() : null;