Community
Participate
Working Groups
The generated code does not use the pre- and suffixes one has set via Java/Code Generation/Names "plugin" should use the Fields prefix and suffix. "resourceBundle" should use the Static Fields prefix and suffix. The method parameters and local variables should also use their respective pre-/suffixes.
Martin/Dani, this is a general issue in which the code generated by PDE (e.g. plug-in templates, activators) do not conform to a user's Java Editor preference settings. Is there a utility in JDT that would take our generated files as input and would spit out nicely-formatted java files?
>...do not conform to a user's Java Editor preference settings. Note, that most of those settings are from JDT Core or JDT UI and not JDT Text (i.e. the Java editor). >Is there a utility in JDT that would take our generated files as input and >would spit out nicely-formatted java files? No, and I think it would be wrong to just take some source and try to convert it. The correct code should be generated. To do this several things are involved: - use the correct templates see JDT UI's CodeGeneration class (API) - generate the code with the right preferences, e.g. prefixes There is JDT Core API to get the field names (see NamingConventions) but this is pretty outdated and JDT UI uses its own internal StubUtility for that. There is bug 38111 which asks JDT Core to make the NamingConventions more flexible, so that it better matches the StubUtility. - format the code see JDT UI's CodeFormatterUtil how to call the JDT Core APIs This can be done using the JDT Core code formatter API. Martin might have more info for you on this when he's back and it is up to him to decide whether JDT UI can provide more API for you.
Thanks Dani for the detailed explanation. I will look into it. If we need more API from JDT/UI, we have some negotiation power :) (bug 147027 and bug 151711)
this can probably be tackled one step at a time. The easiest would probably be formatting the code first.
*** Bug 111327 has been marked as a duplicate of this bug. ***
Bug 111327 is not a 'pure' duplicate of this bug. It just asks for formatting the generated source, which is much simpler. Note that the formatter can't update the field prefixes.
cool. When we get to it post-3.3, we can figure out what is doable and what is not. The common theme here is that the PDE-generated code does not follow the JDT templates in the user preferences.
This bug has not been considered in over 4 years. Closing as WONTFIX. Please reopen if you are interested in contributing a patch.