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.
|Summary:||@annotation to register paletteitem|
|Component:||Palette||Assignee:||Stanislav Aubrecht <saubrecht>|
|Priority:||P3||Keywords:||API, API_REVIEW, API_REVIEW_FAST|
|Issue Type:||ENHANCEMENT||Exception Reporter:|
Proposed patch to handle annotation
Proposed Patch with Updated manifest
Proposed Patch with Updated manifest
Description skygo 2013-03-12 10:11:48 UTC
Draft for annotation to register paletteitem. At package level or for class extending activeeditordrop.
Comment 1 skygo 2013-03-12 10:12:56 UTC
Created attachment 132505 [details] Proposed patch to handle annotation
Comment 2 skygo 2013-12-03 10:36:27 UTC
Sorry for the delay provinding some more details API proposal. I choose to register to NetCAT :p and I was very busy there, so before NetCAT 8 start, I find some time to present. According to wiki pages  and  there is a potential for using annotation to describe palette item. This may help simplifying ressources management at the time Netbeans Platform Users need to create basic palette item. Current process involve icon + layer modification + palette file xml edit. With help of annotations only icons need to be managed, others parts are done with annotation in java files. The API consists of two new annotations: PaletteItemRegistrations for allowing multiple annotation of PaletteItemRegistration PaletteItemRegistration to handle palette item The differents elements for the annotation, // Coordinate for layer String paletteid(); String category(); String itemid(); // Optionnal body for alternate palette String body() default ""; // Visualisation icons, name and tooltip String icon16(); String icon32(); String name(); String tooltip(); Example of usage in a class that extends ActiveEditorDrop @PaletteItemRegistration(paletteid = "JavaPalette", category = "dummycat", itemid = "myitem", "icon16 = "org/netbeans/modules/palette/resources/unknown16.gif", "icon32 = "org/netbeans/modules/palette/resources/unknown32.gif", tooltip = "this is a tooltip", name = "my name for myitem") Example of usage in a package info @PaletteItemRegistration(paletteid = "JavaPalette", category = "dummycat", itemid = "myitem", "icon16 = "org/netbeans/modules/palette/resources/unknown16.gif", + "icon32 = "org/netbeans/modules/palette/resources/unknown32.gif", tooltip = "this is a tooltip", name = "my name for myitem",body ="my body") Best Regards skygo PS: I hope I respect process of fast review.  http://wiki.netbeans.org/MoreDeclarativeRegistrationUsingAnnotations  http://wiki.netbeans.org/DeclarativeRegistrationUsingAnnotations
Comment 3 Stanislav Aubrecht 2013-12-03 10:57:32 UTC
Looks good to me.
Comment 4 skygo 2013-12-05 16:09:54 UTC
Created attachment 142871 [details] Proposed Patch with Updated manifest The initial diff was made long time ago and 7.4 was released with new manifest version. Now patch can be imported with no error.
Comment 5 Jaroslav Tulach 2013-12-06 16:49:05 UTC
Y01 Javadoc of PaletteItemRegistration might contain few samples that use it. Otherwise go on. Add it, imho.
Comment 6 skygo 2013-12-07 01:28:39 UTC
Created attachment 142927 [details] Proposed Patch with Updated manifest Y01: Added example on Registration Javadoc. I revise the processor, a uncauch exeception was thrown in case of wrong resource file. Change processor to source_7. Added Test to check for invalid resource for icons.
Comment 7 Stanislav Aubrecht 2013-12-09 07:49:37 UTC
If there are no objections I'll integrate the changes tomorrow.
Comment 8 Stanislav Aubrecht 2013-12-10 08:40:54 UTC
core-main 226ec9ff52fb Thanks for the patch!