This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
There are a great number of constants described in wizard-guidebook.html, and these constants actually exist in WizardDescriptor.java - yet they are private! This is unfriendly to code completion and makes it too easy to introduce a typo. Please consider the following: 1. Make the constants public, and make sure their Javadoc reflects their usage. 2. Delete wizard-guidebook.html and include any remaining content directly in WD class Javadoc. (Should be small - general notes about where and when to set properties.) 3. Go through NB sources and replace these property names with references to the new constants.
*** Issue 54905 has been marked as a duplicate of this issue. ***
Created attachment 63685 [details] openide.dialogs diff
Created attachment 63686 [details] java.project diff
I've attached diff files with the implementation, magic properties were made constants. Please review. Thanks.
The suggestion in issue #54905 to add setter methods would be even better, as it would (1) enforce the correct value types, (2) permit the impl to throw IAE for inappropriate arguments. This would be easy for wizard-wide properties, e.g.: settings.putProperty("WizardPanel_errorMessage", NbBundle.getMessage(MakeSharableVisualPanel1.class, "WARN_makeSharable.relativePath")); => settings.setErrorMessage(NbBundle.getMessage(MakeSharableVisualPanel1.class, "WARN_makeSharable.relativePath")); These could simply be new final methods on WizardDescriptor. Properties set on wizard panels ("WizardPanel_contentData" etc.) are much uglier: (1) you have to cast to JComponent; (2) you need to set redundant information on each panel (e.g. list of steps). Introducing constants improves the situation somewhat, but perhaps we need a better API structure for this. Not obvious to me whether methods on WD would work for these cases.
Milane, are you going to update all the WizardDescriptor usages?
Jesse, your comment is valid and using final methods would be the best solution, but from looking at the code and from talks with Jirka Rechtacek it seems to be out of scope of this issue. Using properties is not consistent (some of them affects only initial setup, some of them all panels, some of them needs to be set on each JComponent), so doing it right and then correctly replacing of all usages of put[Client]Property() would require more time than we have for 6.5M2 IMO. Therefor I will proceed with the first step - making all those strings constants. > Milane, are you going to update all the WizardDescriptor usages? I could, but I'm kind of afraid of HG, I don't want to spend two weeks of merging conflicts over number of HG clones ... at least I will try.
> Therefor I will proceed with the first step - making all those strings constants. Not sure whether it is a good idea to publish constants and then methods - constants would have to stay public, right? >> Milane, are you going to update all the WizardDescriptor usages? > I could, but I'm kind of afraid of HG, I don't want to spend two weeks of merging conflicts over number of HG > clones ... at least I will try. Thanks a lot, let me know if you have any problems, I could try to help you.
>> Therefor I will proceed with the first step - making all those strings constants. > Not sure whether it is a good idea to publish constants and then methods - constants would have to stay public, right? Well I suppose they will be deprecated as other public API being replaced by newer API.
I agree with introducing documented constants for now. If we later introduced nicer methods, we would anyway need to continue supporting the old properties (whether accessed via the new constants or not), so we could indeed just deprecate the properties. I don't understand the concern about replacing existing usages of the constants. Just do it and push to core-main whenever you like. If and when there are merge conflicts with main, you will be notified, so just pull from main (at a known good revision), merge (resolving the conflicts), and push back to core-main - as documented in HgParallelTeamIntegrationBestPractices. Probably won't be any conflicts at all (most likely in import blocks), but if there are, it should only take a few minutes to resolve.
If there are no more objections I will push the patch tomorrow (together with fix of issue #137737). Thanks for review.
Fixed. http://hg.netbeans.org/core-main/rev/66cb4688e5d5 http://hg.netbeans.org/core-main/rev/8f01861e2c7e http://hg.netbeans.org/core-main/rev/035da5f5cf11
I have objection, but I guess I am too late here. You should use setter methods, not string constants. Constants improve almost nothing, with methods we could make the whole wizard experience much more friendlier...
Jesse had the same concerns and I agree as well, but ... see "comments from mkubec Tue Jul 1 08:25:14 +0000 2008".
You are missing @since on most of the new PROP_* constants; PROP_ERROR_MESSAGE has "3.39" for some reason.
I am also putting comments in apisupport templates that you can use the new constants. (#d402c9f18abe) I am reluctant to actually use the constants by default yet, because people may be developing against an older platform. (It is possible to make the templates sensitive to the platform version, but this seems like a lot of work for a minor gain.)
I actually didn't include @since on purpose, because those constants (as strings) were actually there from beginning, just they weren't public static final ... So I wasn't sure if @since is supposed to be there. PROP_ERROR_MESSAGE was added sometimes later, therefore @since 3.39.
The @since should reflect when the constant was introduced into the API. There can be a separate note about how long the constant's value has been interpreted.
Integrated into 'main-golden', available in NB_Trunk_Production #308 build Changeset: http://hg.netbeans.org/main/rev/66cb4688e5d5 User: Milan Kubec <mkubec@netbeans.org> Log: #137737, #138128: string properties changed to constants; new constants for warning and info messages introduced
Integrated into 'main-golden', available in NB_Trunk_Production #309 build Changeset: http://hg.netbeans.org/main/rev/6051247ca234 User: Milan Kubec <mkubec@netbeans.org> Log: #138128: missing @since tags for new constants added
Integrated into 'main-golden', available in NB_Trunk_Production #310 build Changeset: http://hg.netbeans.org/main/rev/d402c9f18abe User: Jesse Glick <jglick@netbeans.org> Log: Noting the existence of WizardDescriptor.PROP_* constants. (cf. #138128)