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:
Can we make it possible to specify custom categories in the AutoUpdateType service?
Of course! if you provide a patch with implementation.
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): http://blog.nigjo.de/netbeans/2010/11/eigene-icons-im-updatecenter/
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.
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?
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.
Thanks, nice work. I'll keep an eye on it.
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.
[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?
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.
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.
Created attachment 104652 [details]
New patch, together with needed changes for 193944
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.
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.
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).
I'll integrate on Monday.
Integrated into 'main-golden', will be available in build *201101110000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
User: Jaroslav Tulach <firstname.lastname@example.org>
Log: #183778: Custom icons and Categories for Update Centers