|
From: <caw...@us...> - 2007-05-21 21:50:01
|
Revision: 2513
http://svn.sourceforge.net/rubyeclipse/?rev=2513&view=rev
Author: cawilliams
Date: 2007-05-21 14:49:59 -0700 (Mon, 21 May 2007)
Log Message:
-----------
fix how we index external libraries (actually traverse the directory structure!)
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/indexing/AddExternalFolderToIndex.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/indexing/AddExternalFolderToIndex.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/indexing/AddExternalFolderToIndex.java 2007-05-21 21:34:00 UTC (rev 2512)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/indexing/AddExternalFolderToIndex.java 2007-05-21 21:49:59 UTC (rev 2513)
@@ -2,6 +2,7 @@
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
@@ -127,21 +128,7 @@
return false;
}
- File[] children = file.listFiles();
- for (int i = 0; i < children.length; i++) {
- if (this.isCancelled) {
- if (JobManager.VERBOSE)
- org.rubypeople.rdt.internal.core.util.Util.verbose("-> indexing of " + file.getName() + " has been cancelled"); //$NON-NLS-1$ //$NON-NLS-2$
- return false;
- }
- String name = children[i].getName();
- if (Util.isRubyLikeFileName(name)) {
- InputStream stream = new FileInputStream(children[i]);
- char[] contents = Util.getInputStreamAsCharArray(stream, -1, null);
- RubySearchDocument entryDocument = new RubySearchDocument(children[i].getAbsolutePath(), contents, participant);
- this.manager.indexDocument(entryDocument, participant, index, this.containerPath);
- }
- }
+ if (!indexFiles(index, file, participant)) return false;
this.manager.saveIndex(index);
if (JobManager.VERBOSE)
org.rubypeople.rdt.internal.core.util.Util.verbose("-> done indexing of " //$NON-NLS-1$
@@ -161,6 +148,27 @@
return true;
}
+ private boolean indexFiles(Index index, File file, SearchParticipant participant) throws FileNotFoundException, IOException {
+ File[] children = file.listFiles();
+ if (children == null) return true;
+ for (int i = 0; i < children.length; i++) {
+ if (this.isCancelled) {
+ if (JobManager.VERBOSE)
+ org.rubypeople.rdt.internal.core.util.Util.verbose("-> indexing of " + file.getName() + " has been cancelled"); //$NON-NLS-1$ //$NON-NLS-2$
+ return false;
+ }
+ String name = children[i].getName();
+ if (children[i].isFile() && Util.isRubyLikeFileName(name)) {
+ InputStream stream = new FileInputStream(children[i]);
+ char[] contents = Util.getInputStreamAsCharArray(stream, -1, null);
+ RubySearchDocument entryDocument = new RubySearchDocument(children[i].getAbsolutePath(), contents, participant);
+ this.manager.indexDocument(entryDocument, participant, index, this.containerPath);
+ }
+ if (!indexFiles(index, children[i], participant)) return false;
+ }
+ return true;
+ }
+
private void addDirectorysChildren(File file, String EXISTS, SimpleLookupTable indexedFileNames) {
File[] children = file.listFiles();
if (children == null) return;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|