TIP: Structural selection in Netbeans Java editor
Alt+Shift+S - successively selects outer syntactic element. Statement -> Surrounding Block Statements -> Surrounding Block Statements -> Surrounding Method -> Surrounding Class and so on. I use this for quick selection for indentation using Ctrl+T or commenting using Ctrl+Shift+T.
Alt+Shift+A - successively selects inner syntactic element. This works only if you had expanded the selection using the Alt+Shift+S. This helps me fine tune the selection if I went too far.
Posted by sandipchitale
( Jun 27 2006, 07:47:24 AM PDT ) Permalink
Trackback URL: http://blogs.sun.com/scblog/entry/tip_structural_selection_in_netbeans
Posted by Tim Bray on June 27, 2006 at 09:34 AM PDT #
According to this FAQ entry:
http://wiki.java.net/bin/view/Netbeans/DevFaqLogicalKeybindings
Alt+Shift+S on Windows should translate to Ctrl+Shift+S on MAC (Ctrl being Mac Control Key).
I have not tried it though.
Interestingly I cannot find it in the "Keymap" part of preferences. May be that is why this is a Tip :)
Posted by Sandip on June 27, 2006 at 11:39 AM PDT #
You may want to check out this tip from Geertjan also:
http://blogs.sun.com/roller/page/geertjan?entry=netbeans_ide_5_0_easter
Posted by Sandip on June 27, 2006 at 11:59 AM PDT #
Posted by Sandip on June 27, 2006 at 01:12 PM PDT #
As for adjusting indentation: I find that NetBeans does a very good job of this on its own. I just press Ctrl-Shift-F and it does the right thing, according to my formatting preferences. (Sorry Tim, I don't know the Mac key-binding for that one.)
Posted by Ron Ten-Hove on June 30, 2006 at 07:43 AM PDT #
I have a request for an enhancement to your Line Tools.
If you Alt-Shift-S on a block of code, it is true that the block is selected; but the cursor lies at the selection's end. You cannot select more text on the other side of the selection.
However, in Vim you can do this.
(To test this, use the Visual mode to select something, and then type the letter 'O'. The cursor is placed on the other side of the selection and you can continue selecting.)
This ability is helpful in many cases. For example, you can select a block of code, and then select the comments above it.
Is it possible to do this already (to exchange the dot and mark in a text selection)? If not, would you consider adding this capability to one of your tools?
I hope this entry hasn't been too long for you, and that you see and consider it.
Your tools are so useful to me. I can't thank you enough for your contributions.
Thanks,
Jay
Posted by Jay Logan on September 20, 2006 at 04:15 PM PDT #
Yes, have I always wished there was a way to exchange dot and mark (emacs C-x C-x) in the Swing text components themselves. I will look into it. Should be fairly easy.
Posted by Sandip on September 20, 2006 at 06:06 PM PDT #
Alt+Shift+X (Windows) will exchange mark and dot on windows. This works well with Alt+Shift+S.
Posted by Sandip on September 20, 2006 at 07:27 PM PDT #