Excluding directories from search
Submitted by Thursday, 3 August, 2006 - 23:25
on
I often use jedits hypersearch through big directory structures (eg. to find references to old datastructures or import-like language constructs, after fundamental rewrites, etc.). While I'm very fond of hypersearchs speed, there are directories i want to exclude from search, because they contain lots of irrelevant data (eg. caching directories) and therefore delay the search to no avail.
Now my favourite solution to the problem would be, to write a simple config file (like every newline a separate dir) "ExcludeDirs.cfg" or something, where search could look up directories that must not be visited recursively. After some browsing through the jEdits code I found the class VFS. There I would, for a quick personal hack, introduce an ArrayList that loads the "ExcludeDirs.cfg" and a boolean member that tells the class if the exclusion mechanism is necessary for its current use (because, VFS isn't used by search only). Inside the function listFiles I could add something like
if(!ExcludeDirs.contains(canonPath))
// recursive call to subdir
and hope that it works.
Now, before i start, i would like to hear some comments. I'm a complete jEdit starter so I don't know what the idiomatic way to solve this within jedits framework would be or if it could be solved with a simple extension mechnasim like a macro or plugin (or it is already there and i couldn't locate it). From my personal feeling VFS seems a bit too low-level for the task, on the other hand it's the only approach i can think of, that manipulates jEdits code directly without changing one interface. Furthermore i could think of other tasks where configurated exclusion of directories at this abstraction level could be relevant.
Thanks in advance
Mischan Gholizadeh Toosarani
Now my favourite solution to the problem would be, to write a simple config file (like every newline a separate dir) "ExcludeDirs.cfg" or something, where search could look up directories that must not be visited recursively. After some browsing through the jEdits code I found the class VFS. There I would, for a quick personal hack, introduce an ArrayList that loads the "ExcludeDirs.cfg" and a boolean member that tells the class if the exclusion mechanism is necessary for its current use (because, VFS isn't used by search only). Inside the function listFiles I could add something like
if(!ExcludeDirs.contains(canonPath))
// recursive call to subdir
and hope that it works.
Now, before i start, i would like to hear some comments. I'm a complete jEdit starter so I don't know what the idiomatic way to solve this within jedits framework would be or if it could be solved with a simple extension mechnasim like a macro or plugin (or it is already there and i couldn't locate it). From my personal feeling VFS seems a bit too low-level for the task, on the other hand it's the only approach i can think of, that manipulates jEdits code directly without changing one interface. Furthermore i could think of other tasks where configurated exclusion of directories at this abstraction level could be relevant.
Thanks in advance
Mischan Gholizadeh Toosarani