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 206954 - Annotation to register navigator panels
Summary: Annotation to register navigator panels
Alias: None
Product: platform
Classification: Unclassified
Component: Navigator (show other bugs)
Version: 7.1
Hardware: All All
: P3 normal (vote)
Assignee: Jesse Glick
Depends on: 129558 206957 207001
  Show dependency tree
Reported: 2012-01-05 17:21 UTC by Jesse Glick
Modified: 2012-01-13 21:52 UTC (History)
2 users (show)

See Also:
Exception Reporter:

Proposed patch (27.95 KB, patch)
2012-01-05 19:34 UTC, Jesse Glick
Details | Diff
Revised patch (42.30 KB, patch)
2012-01-06 19:51 UTC, Jesse Glick
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Comment 1 Jesse Glick 2012-01-05 19:34:58 UTC
Created attachment 114669 [details]
Proposed patch
Comment 2 Jesse Glick 2012-01-05 19:35:25 UTC
Please review.
Comment 3 Jaroslav Tulach 2012-01-06 12:52:42 UTC
Y01 Better support for laziness. Right now all NavigatorPanel interfaces need to be loaded, even only one of them is usually visible. Avoid this. I'd suggest to include displayName, hint and other necessary attribute to the @Registration annotation.

Y02 Simplify the API. Allow people to annotate any JComponent with the annotation, so in simple cases people don't need to create the NavigatorPanel interface at all.
Comment 4 Jesse Glick 2012-01-06 18:11:12 UTC
Y01 - can look into this, though note that the payoff is small: leaving aside the special case of XMLNavigatorPanel (cf. bug #129558) which is likely to be loaded anyway, the only known cases of a MIME type with more than one panel are text/x-maven-pom+xml (2) and text/x-java (6), meaning at best six classes saved (but one proxy class added in all cases).

Y02 is out of scope, and probably not feasible anyway since it would not permit the context to be attached.
Comment 5 Jaroslav Tulach 2012-01-06 19:13:47 UTC
Re. Y01, OK, please look at it. Achieving scalability with annotations is much easier than with old java classes and can only pay off.

Re. Y02: The component could have a constructor taking Lookup it would be passed into it. Moreover the component could take any Type (for example JavaSource) which would then be injected into it.
Comment 6 Jesse Glick 2012-01-06 19:29:10 UTC
(In reply to comment #4)
> text/x-java (6)

...and four of those six are in java.debug, where they are conditionally displayed in dev builds, meaning they cannot be represented with a lazy annotation. (cf. bug #207001)
Comment 7 Jesse Glick 2012-01-06 19:36:01 UTC
Y02 - ctor taking Lookup would be possible, but a little subtle because the infrastructure might actually need to pass a proxy for the current lookup, unlike the current panelActivated which might be called several times with different lookups. Ctor taking the specific type (or collection?) would not work at all unless the JComponent were recreated each time the panel were displayed, which is not necessarily efficient. Activated and deactivated events would still need to be sent somehow, so you would need to separately document what JComponent methods these correspond to. getLookup would not work unless you implemented Lookup.Provider, which would also need to be separately documented. All in all, it seems like this would make everything more complicated, not simpler, and make documentation worse since there would be no natural "home" for Javadoc explaining what each method should do; and upgrading current NP impls would not be trivial. If you really want this, it can be done as a separate API review but I do not plan to work on it.
Comment 8 Jesse Glick 2012-01-06 19:51:08 UTC
Created attachment 114689 [details]
Revised patch

Includes Y01 and converts some more registrations.
Comment 9 Jesse Glick 2012-01-12 14:13:23 UTC
core-main #a263d7624177
Comment 10 Quality Engineering 2012-01-13 21:52:19 UTC
Integrated into 'main-golden'
User: Jesse Glick <>
Log: #206954: annotation to register navigator panels.