views:

17

answers:

1

I've been looking for the Eclipse JDT refactoring tool which allows me to quickly change

if (...) {
  Object x = blablabla;
}

to

Object x;
if (...) {
  x = blablabla;
}
// insert code using x here

But I can't find it. Does something like that exist?

+2  A: 

No.

But, you can use the "Split Variable Declaration" refactoring (CTRL+1 on the declaration gets you a list of possible refactoring options) and than relocate the declaration yourself using Cut/Paste or drag&drop.

zvikico
Good enough, it so happens I was also looking for that option.
Bart van Heukelom
...or alt-up arrow. Or option-up arrow for Mac users.
Carl Manaster