Community
Participate
Working Groups
Build Identifier: 20110916-0149 Bug 367587 asks to add an option for quick fix to put local variable declarations at the top of the method instead of at the point of first assignment. This enhancement request is to add an option to Preferences | Java | Code Style | Clean Up | Code Style | Variable declarations. The option would control where local variable declarations are placed during cleanup. The 2 options I can think of are at the top of the method and at first assignment. Reproducible: Always
A Save Action (or a Clean Up) can probably work here and makes more sense than configuring the quick fix. Note that JDT can be extended with additional Clean ups and Save Actions. See http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.jdt.doc.isv%2Fguide%2Fjdt_api_contributing_a_cleanup.htm => Read as: you can write a clean up for your use (and maybe later provide a patch here for consideration in JDT)
As mentioned in bug 367587, putting all local variable declarations at the start of a method is not a popular or even a recommended style. Hence, this clean up will not be added to JDT. (However, as mentioned in comment 1 you should be able to write your own Clean Up)