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.
the current api for palette items for text-based editors enforces the usage of resource bundles for item display name. therefore it isn't possible to create new palette items at runtime upon user's request (e.g. new code snippets) the change is a simple enhancement of palette item's DTD to allow inlined description without the need for resource bundle. the current format is: <description localizing-bundle="org.netbeans.modules.html.palette.items.resources.Bundle" display-name-key="NAME_html-TABLE" tooltip-key="HINT_html-TABLE" /> the new format for items created by the user at runtime will be: <inline-description> <display-name>my code snippet</display-name> <tooltip> long description for my code snippet </tooltip> </inline-description> the two formats above are mutually exclusive, see the attachment.
Created attachment 37569 [details] proposed implementation
For jMaki plugin this is critical. We did an ugly workaround to *call*, (yes) private method on the module class loader to add a set of classes (byte code generated on the fly) and bundles... This is what it takes to provide value to the customers. Another way to fix that would be to open a little bit more the very very private class loading implementation in Nb. This is related (a little) to plugins to define dependant jars/dir that are not under the modules/ext area for example, but somewhere on disk...
The class name element could also be parametrizable, so that I can pass a String parameter to the object repesenting the palette. This way the class would be known at compile time, but based on this parameter, we could dbd and drop what we want. Fro jMaki we cannot use static snippet since we need validation and add more than the snippet code when DnD. We need a class. Having a class per palette entry is a bit too heavy and not extensible dynamically.
New DTD is good solution. The patch contains System.err.println There is no test, please write one - e.g. create a file on SystemFileSystem conforming to new DTD and make sure it is recognized.
if there are no more comments, i'll integrate tomorrow
what about adding some parameters to the class name so that we can use the same class but with different args?
> what about adding some parameters to the class name so that we can use the same > class but with different args? i've created a separate issue for that: #93451
What do you want to integrate? The proposed patch or some other patch? I guess the proposed patch is not integratable. It contains system.err and there is no test. Imho it should not be integrated as it is.
i'll remove the sysstem.err and add a test. the dtd will remain the same as in the attached patch.
What about inline-description tag example, which is a part of the DTD?
> What about inline-description tag example, which is a part of the DTD? i'll fix that as well:)
integrated to trunk: Checking in src/org/netbeans/modules/palette/resources/editor-palette-item-1_1.dtd; /cvs/core/palette/src/org/netbeans/modules/palette/resources/editor-palette-item-1_1.dtd,v <-- editor-palette-item-1_1.dtd initial revision: 1.1 done Checking in src/org/netbeans/modules/palette/resources/layer.xml; /cvs/core/palette/src/org/netbeans/modules/palette/resources/layer.xml,v <-- layer.xml new revision: 1.11; previous revision: 1.10 done Checking in api/doc/changes/apichanges.xml; /cvs/core/palette/api/doc/changes/apichanges.xml,v <-- apichanges.xml new revision: 1.14; previous revision: 1.13 done Checking in src/org/netbeans/modules/palette/PaletteEnvironmentProvider.java; /cvs/core/palette/src/org/netbeans/modules/palette/PaletteEnvironmentProvider.java,v <-- PaletteEnvironmentProvider.java new revision: 1.10; previous revision: 1.9 done Checking in src/org/netbeans/modules/palette/PaletteItemNode.java; /cvs/core/palette/src/org/netbeans/modules/palette/PaletteItemNode.java,v <-- PaletteItemNode.java new revision: 1.10; previous revision: 1.9 done Checking in src/org/netbeans/modules/palette/PaletteItemHandler.java; /cvs/core/palette/src/org/netbeans/modules/palette/PaletteItemHandler.java,v <-- PaletteItemHandler.java new revision: 1.6; previous revision: 1.5 done Checking in test/unit/src/org/netbeans/spi/palette/PaletteItemTest.java; /cvs/core/palette/test/unit/src/org/netbeans/spi/palette/PaletteItemTest.java,v <-- PaletteItemTest.java new revision: 1.7; previous revision: 1.6 done Checking in editor-palette-item-1_1.dtd; /cvs/www/www/dtds/editor-palette-item-1_1.dtd,v <-- editor-palette-item-1_1.dtd initial revision: 1.1 done