NetBeans has a helpful (to me anyway!) feature under the "Views" menu, called "Synchronize Editor with Views". As the name suggests, toggling this on will cause the navigator view to jump straight to a file when it's opened in the editor.
I generally prefer this to the normal "Ctrl+Shift+1" shortcut for manually jumping to a file. However, the downside is that after editing several files, your navigator tree is a mess of multiple open directories.
Eclipse has similar functionality, but it also has a "collapse all开发者_开发百科" button at the top of its navigator view... restoring things with a single click having to scroll around. Does NetBeans have any similar mechanism for collapsing open directories? Maybe a poorly-documented keyboard shortcut buried in there or something?
Unrelated to your question, but some interesting code folding shortcuts are:
Action | Shortcut |
---|---|
Collapse Fold | Ctrl+Minus |
Expand Fold | Ctrl+Plus |
Collapse All Folds | Ctrl+Shift+Minus |
Expand All Folds | Ctrl+Shift+Plus |
Unfortunately, after further digging on the NetBeans discussion forums and mailing lists, it seems that this functionality simply doesn't exist. That's a shame... hopefully they'll add it in the future.
Answer: It is not possible.
Workaround: Close the project and reopen it. It will start collapsed.
Close the navigator (press the x). Then go to Window->Navigating->Navigator or press Ctrl+7. It should open the navigator with all collapsed.
http://variousfixes.wordpress.com/2011/09/03/how-to-collapse-all-elements-in-netbeans-navigator/
精彩评论