Wednesday, April 12, 2006

NetBeans plugins I use, part 3: Quick File Chooser

WARNING: This blog entry was imported from my old blog on blogs.sun.com (which used different blogging software), so formatting and links may not be correct.


Don't get me wrong: I generally love the OSX user interface. But the one thing I can't stand is the file chooser. On other platforms, you can usually type the path you want to go to, but on the Mac, you have to drill down, with a mouse*, from one of the "root" directories - e.g. home, Desktop or Documents. Yuck.



If you're a keyboard guy like me, there is a solution: The Quick File Chooser. This plugin registers an alternate file chooser with the IDE, which is then used everywhere a filechooser is used.



The plugin is named the "Quick" file chooser for a good reason. Not only can I type in a path to a place I want to go more quickly than I can drill down to it with a file chooser (especially in directories with lots of files, such that I have to scroll to find the next intermediate folder to click on). But it also has additional shortcuts.



First, I can press the Tab key to force automatic completion. This works the same way as in modern Unix command line shells. If I've typed "P", and the only file in this directory that begins with a "P" is named "Projects", pressing Tab will update the path to "Projects". When there are multiple matches it will expand as far as possible.



Second, I can use environment variables again! Yipee!! I've really missed this feature. I used to do all my navigation with environment variables when I was an avid Emacs user. I had defined important directory locations with environment variables. For example, $D would point to the main debugger source directory; $E the editor, and so on. I could simply hit C-x C-f to open a file, and enter the path as $D/Breakpoint.cc to open the Breakpoint class. With the Quick File Chooser, you can again embed environment variables within the path, and everything is substituted correctly.



Here's a screenshot of the plugin in action. As you can see I've typed in an environment variable to jump to my NetBeans source tree, and I've started typing a path - and all the files are filtered down to the possible matches so far:






Thank you, Jesse and Tim!



If you want to get this module, go get it from nbextras.org/. The instructions for how to connect to it via the NetBeans Update Center are here.




*: There is an unintuitive way to jump to an arbitrary directory, in some applications, by going to the Search field and starting to type a path. Provided the first character is "/", this will cause a dialog to pop up where you can type the directory. But this is not a decent workaround, because it only works for absolute paths, there's no tab completion etc. And worse yet, many applications (including NetBeans) don't include a Search button next to the directory dropdown.


1 comment:

  1. I used this plugin for a while - I really liked it. But the one big drawback forced me to revert to the original: the quick file chooser does not allow multiple files selections. In many of today's serious projects one needs to include quite many jar files for "libraries" section of the project and doing it one-by-one is painful. It would be helpful to allow selection of files via regular expressions, like some UNIX shells do.

    ReplyDelete