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.
Draft for annotation to register paletteitem. At package level or for class extending activeeditordrop.
Created attachment 132505 [details] Proposed patch to handle annotation
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 [1] and [2] 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. [1] http://wiki.netbeans.org/MoreDeclarativeRegistrationUsingAnnotations [2] http://wiki.netbeans.org/DeclarativeRegistrationUsingAnnotations
Looks good to me.
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.
Y01 Javadoc of PaletteItemRegistration might contain few samples that use it. Otherwise go on. Add it, imho.
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.
If there are no objections I'll integrate the changes tomorrow.
core-main 226ec9ff52fb Thanks for the patch!