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 183778 - Custom icons and Categories for Update Centers
Summary: Custom icons and Categories for Update Centers
Alias: None
Product: platform
Classification: Unclassified
Component: Autoupdate (show other bugs)
Version: 6.x
Hardware: All All
: P1 normal with 2 votes (vote)
Assignee: Jaroslav Tulach
Depends on: 193944
  Show dependency tree
Reported: 2010-04-09 14:58 UTC by andybob
Modified: 2011-01-11 06:09 UTC (History)
2 users (show)

See Also:
Exception Reporter:

sample layer for individual autoupdate category (1.21 KB, application/xml)
2010-11-19 09:22 UTC, nigjo_iqn
Patch against nightly 201011210001 (10.87 KB, patch)
2010-11-21 12:59 UTC, nigjo_iqn
Details | Diff
Adding support for categoryIconBase attribute (45.00 KB, patch)
2010-11-24 09:58 UTC, Jaroslav Tulach
Details | Diff
New patch, together with needed changes for 193944 (60.52 KB, patch)
2011-01-02 19:32 UTC, Jaroslav Tulach
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description andybob 2010-04-09 14:58:05 UTC
Currently when registering a update center via the layer.xml for a module one can
specify a category (STANDARD,COMMUNITY,BETA) for the update center.  Each of these categories gets a canned icon and description.  For the platform application we are developing, when registering an update-center, we would like to specify our own categories with our own icons.

For example we might have the following categories each with our own custom icons:
Open Source
Closed Source
Community Contributed

Can we make it possible to specify custom categories in the AutoUpdateType service?
Comment 1 Jaroslav Tulach 2010-11-10 13:44:51 UTC
Of course! if you provide a patch with implementation.
Comment 2 nigjo_iqn 2010-11-14 13:32:10 UTC
I did some quick research and I think it is possible if we get rid off"org.netbeans.api.autoupdate.UpdateUnitProvider.CATEGORY" from "Auto Update Services" in some way.

This enum blocks dynamic generation of new categories and icons.

In a first test I replaced it by a simple class implementing name() and valueOf() methods. Than I created a new Category "PORTAL" in layer only and could change the icon successfully.

I do not have a patch, yet, but a (first) screen shot is in my blog (german only):
Comment 3 Jaroslav Tulach 2010-11-15 09:03:55 UTC
Thanks for your work (future and also done so far)!

I cannot easily turn CATEGORY into class, that would not be backward compatible. But if you provide a patch based on CATEGORY being a class, I can find a way to make it work and remain compatible.

Reopen when you attach your work.
Comment 4 nigjo_iqn 2010-11-19 09:22:50 UTC
Created attachment 103095 [details]
sample layer for individual autoupdate category

I successfully installed my first update center with an individual category icon. To do so i had to define a new folder inside the layer. My choice was "/Services/AutoupdateCategory". Any other suggestions?
Comment 5 nigjo_iqn 2010-11-21 12:59:11 UTC
Created attachment 103162 [details]
Patch against nightly 201011210001

The changes should work in 6.9 too.

They WILL break every module depending on special enum Features like the ordinal. The methods "name", "valueOf" and "values" are implemented so no problem exists here.

The "ordinal" of the enum is no longer suitable because of the dynamic creation of categories, so I think this will not be a problem.
Comment 6 Jaroslav Tulach 2010-11-21 21:45:45 UTC
Thanks, nice work. I'll keep an eye on it.
Comment 7 Jaroslav Tulach 2010-11-24 09:58:00 UTC
Created attachment 103272 [details]
Adding support for categoryIconBase attribute

Please verify my patch satisfies your needs. If so, I can integrate it on Nov 30, 2010.
Comment 8 Jesse Glick 2010-11-24 15:53:36 UTC
[JG01] Should be documented that getSourceIcon and getSourceDescription may return null and what that means. (Recommend using @CheckForNull.)

[JG02] Shouldn't CATEGORY itself be deprecated, since it appears that all its referring elements are to be deprecated?
Comment 9 nigjo_iqn 2010-11-24 20:24:11 UTC
The Icon shows up correctly if I set "categoryIconBase" for my update center. Nice work.

But there seems to be a problem with the category itself.

I still can enter "STANDARD", "BETA", "COMMUNITY" only. If I try to set an individual "display name" into "category" for the first time I got an Exception which I can't reproduce at the moment. But nether I put into the "category" attribute the UI shows only "COMMUNITY" for the modules of my update center.
Comment 10 nigjo_iqn 2010-12-08 13:42:13 UTC
Sorry for the delay, but I have found no time before that.

All tests are done with a local NBM file.

[NI01] I got another Exception: It will occure when a "categoryIconBase" is set but no "category". The assert in the ProviderCategory constructor will throw the exception. In this case the problem is in AutoupdateCatalogFactory (around line 135:

pc = ProviderCategory.create(categoryIconBase, categoryName);

"categoryName" may be null.

[NI02] When I uninstall the UpdateCenter Module the corresponting entry in the List of knonw centers will still be there (Maybe another bug [NI02a]). After restart the IDE you got another NPE in SettingsTab.UpdateProviderRenderer. The "UpdateUnitProvider" returns null because the icon can't be found no longer. (see [JG01])

[NI03] A mentioned in JG01 and NI02 the main problem for the UI is, that now "null" values can be returned by UnitProviders. This should be handled properly.
Comment 11 Jaroslav Tulach 2011-01-02 19:32:33 UTC
Created attachment 104652 [details]
New patch, together with needed changes for 193944
Comment 12 Jaroslav Tulach 2011-01-02 19:34:00 UTC
I have not addressed JG02. CATEGORY is still OK to be used I think. Otherwise I hope I addressed the rest of your comments. To be integrated on Jan 10, 2011, if there are no objections.
Comment 13 nigjo_iqn 2011-01-03 12:14:15 UTC
works well for me.

Just two minor hints:

* The patch is missing the relocation of the icon files. This will result in an StackOverflowError. Your old patch does contain this relocation.
* "apichanges.xml" contains the "old" date and attribute name.
Comment 14 Jaroslav Tulach 2011-01-03 16:02:02 UTC
I have forgotten to use hg diff --git, thus the missing relocation. 

Thanks for verification. I'll fix the date and integrate on Jan 10, 2011 (if I don't forget).
Comment 15 Jaroslav Tulach 2011-01-07 09:59:49 UTC
I'll integrate on Monday.
Comment 16 Jaroslav Tulach 2011-01-09 08:40:24 UTC
Comment 17 Quality Engineering 2011-01-11 06:09:55 UTC
Integrated into 'main-golden', will be available in build *201101110000* on (upload may still be in progress)
User: Jaroslav Tulach <>
Log: #183778: Custom icons and Categories for Update Centers