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.

Bug 210323 - Annotation to register BeanInfo & PropertyEditor search paths
Summary: Annotation to register BeanInfo & PropertyEditor search paths
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Property Sheet (show other bugs)
Version: 7.2
Hardware: All All
: P3 normal (vote)
Assignee: Jan Horvath
URL:
Keywords: API, API_REVIEW_FAST, PERFORMANCE
Depends on: 218300
Blocks: 200636
  Show dependency tree
 
Reported: 2012-03-28 21:07 UTC by Jesse Glick
Modified: 2014-11-05 12:11 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
patch (38.20 KB, patch)
2012-11-23 19:02 UTC, Jan Horvath
Details | Diff
fixed patch (37.83 KB, patch)
2012-11-26 17:53 UTC, Jan Horvath
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2012-03-28 21:07:06 UTC
See bug #200636 comment #7 JG07. The candidate packages that I know of are:

org.netbeans.beaninfo
org.netbeans.beaninfo.editors
org.netbeans.core.execution.beaninfo
org.netbeans.core.execution.beaninfo.editors
org.netbeans.modules.cnd.builds
org.netbeans.modules.collab.ui.beaninfo
org.netbeans.modules.form.beaninfo.awt
org.netbeans.modules.form.beaninfo.swing
org.netbeans.modules.xml.tax.beans.beaninfo
org.netbeans.modules.xml.tax.beans.editor
org.openide.explorer.propertysheet.editors

I would propose a pair of PACKAGE annotations in openide.explorer, with an @OnStart task to process them. (And perhaps also listen for subsequent changes, in case the registering module is dynamically unloaded, though this would not happen in the IDE.)

Both the regular core bridge and org.netbeans.core.osgi.Activator could be simplified by this.

May also want a TYPE annotation for PropertyEditorManager.registerEditor, which PropUtils.getPropertyEditor would load (since PEM.rE cannot be made really lazy):

org.netbeans.modules.form.editors.KeyStrokeEditor
org.netbeans.beaninfo.editors.CharEditor
org.netbeans.beaninfo.editors.StringArrayEditor
org.netbeans.beaninfo.editors.IntEditor
org.netbeans.beaninfo.editors.BoolEditor

(I18nFormCrossModule cannot clearly be removed this way since it uses FormPropertyEditorManager.registerEditor which allows multiple editors for a single type; perhaps something in openide.explorer could return a List<PropertyEditor>, and FPEM could take advantage of it?)

If you agree this would be useful, can do as a separate API review after bug #200636 is merged, to remove a few more ModuleInstall's that would otherwise be recalcitrant.
Comment 1 Jaroslav Tulach 2012-09-19 13:49:05 UTC
This is very similar to work done by Jan in bug 218300.
Comment 2 Jan Horvath 2012-11-23 19:02:13 UTC
Created attachment 128328 [details]
patch
Comment 3 Jaroslav Tulach 2012-11-23 19:17:13 UTC
Y01 Adding abstract method like  public abstract void registerBeanInfoSearchPath() is an incompatible change. To avoid problems with it I'd suggest to do the registration inside of registerPropertyEditors(). Unless there is some strong reason for having these two kinds of registrations separated. On the other hand static method like NodeOp.registerBeanInfoSearchPath is probably going to cause no API issues (but see Y03).

Y02 "Add the annotated package to the list of package names" - what 'list of package names' do you mean?

Y03 Lowest priority: Is there really a usecase for someone registering just property editor and not bean infos (or vice-versa)? Maybe there could be a single method to register everything (although I admit I don't know how to name it).

Y04 Useless printing does not belong into test. System.out.println("- " + path[i]); if you want to get some logging info when the test fails use Logger and override logLevel().

Thanks for simplifying code in so many modules!
Comment 4 Jan Horvath 2012-11-26 17:53:24 UTC
Created attachment 128416 [details]
fixed patch
Comment 5 Jan Horvath 2012-11-27 12:16:27 UTC
Y01 - Y04 fixed
Comment 6 Quality Engineering 2012-12-06 02:36:50 UTC
Integrated into 'main-golden', will be available in build *201212060001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/f8084d0ee724
User: Jan Horvath <jhorvath@netbeans.org>
Log: #210323 Annotation to register BeanInfo & PropertyEditor search paths