Bug 51870 - [Templates] Plugin class creation wizard; created do not variale pref-/suffixes
Summary: [Templates] Plugin class creation wizard; created do not variale pref-/suffixes
Status: RESOLVED WONTFIX
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: PC All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: PDE-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
: 111327 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-02-12 12:37 EST by Sebastian Davids CLA
Modified: 2011-06-07 15:56 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Davids CLA 2004-02-12 12:37:03 EST
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.
Comment 1 Wassim Melhem CLA 2006-08-13 20:50:13 EDT
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?

Comment 2 Dani Megert CLA 2006-08-14 05:34:29 EDT
>...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.
Comment 3 Wassim Melhem CLA 2006-08-15 01:18:13 EDT
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)
Comment 4 Chris Aniszczyk CLA 2006-12-27 23:28:28 EST
this can probably be tackled one step at a time.

The easiest would probably be formatting the code first.
Comment 5 Wassim Melhem CLA 2007-04-15 01:26:28 EDT
*** Bug 111327 has been marked as a duplicate of this bug. ***
Comment 6 Martin Aeschlimann CLA 2007-04-16 04:06:43 EDT
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. 
Comment 7 Wassim Melhem CLA 2007-04-16 08:05:38 EDT
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.
Comment 8 Curtis Windatt CLA 2011-06-07 15:56:04 EDT
This bug has not been considered in over 4 years.  Closing as WONTFIX.  Please reopen if you are interested in contributing a patch.