sandip chitale's blog    Sandip Chitale's blog (scblog)
NOTE: I have moved many of my modules to NetBeans Plugin Portal . Please check there for latest versions of modules described on this blog.
20060627 Tuesday June 27, 2006

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 Comments [8]


Trackback URL: http://blogs.sun.com/scblog/entry/tip_structural_selection_in_netbeans
Comments:

Two questions: 1. Where are these on the Mac? 2. Where are they categorized in the "Keymap" part of preferences?

Posted by Tim Bray on June 27, 2006 at 09:34 AM PDT #

Tim,

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 #

I take that back. I found them categorized in the "Keymap" part of preferences under the "Other" category.

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 #

The names of the actions are: Select Next Element Select Previous Element

Posted by Sandip on June 27, 2006 at 01:12 PM PDT #

NetBeans has a lot of clever editing features, and a lot key-bindings to them are hidden as "other" in the key map.

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 #

Hello,

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 #

Thanks Jay.

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 #

Done.

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 #

Post a Comment:

Name:
E-Mail:
URL:

Your Comment:

HTML Syntax: NOT allowed








« December 2009
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  
       
Today

Get NetBeans 5.5

Locations of visitors to this page

Today's Page Hits: 298


XML
All
/Creator
/General
/Hobby
/Java
/JavaScript
/Mozilla
/NetBeans
/Ubuntu
/VisualWeb
/VisualWebPack
/Web 2.0

XML
All
/Creator
/General
/Hobby
/Java
/JavaScript
/Mozilla
/NetBeans
/Ubuntu
/VisualWeb
/VisualWebPack
/Web 2.0

scblog
scblog