views:

128

answers:

1

In Eclipse if you have a method:

String MyObject.getValue();

When using this you can go:

MyObject.getValue(); 

If you cursor is on the line and you hit CTRL+1 you get a context menu to 'assign a new local varaible', resulting in the following:

String value = MyObject.getValue(); 

Can you do this as easily in IntelliJ, I've search the net but without success.

Regards.

+3  A: 

Yep! This is the Introduce Variable refactoring. By default, select some text, and then hit Ctrl + Alt + V. If the expression is incomplete or invalid, IntelliJ will still make a good guess about what you meant and try to fix it for you.

John Feminella
Thanks. I was using CTRL+ALT+F but this didnt offer a 'local' option.
JamesC

related questions