X

Geertjan's Blog

  • July 11, 2012

Semantic Moving in NetBeans IDE 7.2

Geertjan Wielenga
Product Manager

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".)

Join the discussion

Comments ( 2 )
  • IGweJK Thursday, July 12, 2012

    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!


  • Geertjan Thursday, July 12, 2012

    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.


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.