Semantic Moving in NetBeans IDE 7.2

So, you're using NetBeans IDE and you have a bunch of code, such as the "getName" method below, that you'd like to move up:

So, you press Alt-Shift-Up, which is great the first time, because as you can see above there's an empty line above the method I'm moving. However, if I press Alt-Shift-Up a second time, you end up inside the next method, which breaks your code, as you can see below:

So, in NetBeans IDE 7.2, you can use "Alt-Shift-Page Up" instead. When you do so, the action you're performing is aware of the context of what you're moving, as well as the context around it. Therefore, if I press "Alt-Shift-Page Up" twice, below, the method ends up above (instead of inside, i.e., it jumps right over) the method that it would otherwise have entered:

What's also cool is that you don't need to select the entire method. Below, I have one whole method, plus the start of the next method. When I use "Alt-Shift-Page Up" now, then both complete methods will move as a whole, together:

The point is that the code will never break, i.e., no compile errors will occur, if you use "Page Up" instead of "Up", together with Alt-Shift. (Same thing with "Alt-Shift-Page Down" instead of "Alt-Shift-Down".)

Comments:

yea really cool. There are more reasons even I could say cool about NetBeans 7.2, it saved me from lots or trouble quite recently!

Posted by IGweJK on July 12, 2012 at 12:45 AM PDT #

Great to hear. And what are those reasons? Maybe you could write an article about it on http://netbeans.dzone.com -- drop me a line at geertjan.wielenga@oracle.com if needed.

Posted by Geertjan on July 12, 2012 at 01:55 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today