It just occurred to me that the following might be possible, and not only is it possible, Eclipse already does it.
Normally IDE auto-complete works forwards, i.e. you declare your variables, and then when you come to use them, they are suggested.
But it can/does also work the other way around. You use a variable which is undefined, then place your cursor above the usage and start to declare it, and it fills in name of the variable you want to define for you.