| Summary: | [generate constructor] Generate constructor using fields globally sets access modifier to private | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Rene Samselnig <rene.samselnig> | ||||||
| Component: | UI | Assignee: | Markus Keller <markus.kell.r> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||
| Severity: | minor | ||||||||
| Priority: | P3 | CC: | amj87.iitr, daniel_megert, deepakazad, markus.kell.r, rene.samselnig, samrat.dhillon | ||||||
| Version: | 3.8 | ||||||||
| Target Milestone: | 4.3 M2 | ||||||||
| Hardware: | All | ||||||||
| OS: | All | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Rene Samselnig
Created attachment 216340 [details]
Patch to modify SourceActionDialog
Proposing a patch. This patch attempts to not save the constructor visibility modifier in preferences when generating constructor for enum types.
Thanks for the patch Samrat. Moving to JDT/UI. The patch needs some work: - Code formatting - e.printStackTrace() is a no-go. Use JavaPlugin.log(e) if really necessary - Make sure this behaves right for all subclasses of SourceActionDialog. I'm pretty sure the fix is wrong for other source actions, e.g. "Generate Getters and Setters" on an enum type. Created attachment 216801 [details]
Patch to modify SourceActionDialog
Markus thanks for your comments. I changed the formatting and removed the printStackTrace. I did not realize that "SETTINGS_VISIBILITY_MODIFIER" was also being used to drive the visibility of other things in different dialogs.
Now the code explicitly checks if the dialog is an instanceof GenerateConstructorUsingFieldsSelectionDialog class. This may be a bit ugly, but I think it works for now. Another way could have been moving the close functionality to each of the individual dialog classes that extend SourceActionDialog so that each class can modify the behavior if it wants to. It will require a bit of refactoring.
Just wanted to send out a gentle reminder to review this patch. Superclasses should generally not refer to individual subclasses. Fixed in a more generic fashion: http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=3f6103cca10d4dcdc9f6da6c91e9226a94a02deb |