# This patch file was generated by NetBeans IDE # Following Index: paths are relative to: D:\projects\nb\core\palette # This patch can be applied using context Tools: Patch action on respective folder. # It uses platform neutral UTF-8 encoding and \n newlines. # Above lines and this line are ignored by the patching process. Index: src/org/netbeans/modules/palette/resources/editor-palette-item-1_1.dtd *** D:\projects\nb\core\palette\src\org\netbeans\modules\palette\resources\editor-palette-item-1_1.dtd No Base Revision --- D:\projects\nb\core\palette\src\org\netbeans\modules\palette\resources\editor-palette-item-1_1.dtd Locally New *************** *** 1,0 **** --- 1,110 ---- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: api/doc/changes/apichanges.xml *** D:\projects\nb\core\palette\api\doc\changes\apichanges.xml Base (1.13) --- D:\projects\nb\core\palette\api\doc\changes\apichanges.xml Locally Modified (Based On 1.13) *************** *** 193,198 **** --- 193,216 ---- + + + + Allow display name and tooltip to be defined directly in item's XML + + + + + +

+ Now it's possible to specify item's display name and tooltip directly in item's + XML definition (instead of providing bundle name and keys). It's needed for items + created at runtime, for example code snippets highlighted in the editor and dropped + to the palette. +

+
+ +
Index: src/org/netbeans/modules/palette/PaletteEnvironmentProvider.java *** D:\projects\nb\core\palette\src\org\netbeans\modules\palette\PaletteEnvironmentProvider.java Base (1.9) --- D:\projects\nb\core\palette\src\org\netbeans\modules\palette\PaletteEnvironmentProvider.java Locally Modified (Based On 1.9) *************** *** 163,169 **** ic.add(s, ActiveEditorDropDefaultProvider.getInstance()); } ! return new PaletteItemNode( new DataNode(xmlDataObject, Children.LEAF), name, handler.getBundleName(), --- 163,170 ---- ic.add(s, ActiveEditorDropDefaultProvider.getInstance()); } ! return (null == handler.getDisplayName()) ! ? new PaletteItemNode( new DataNode(xmlDataObject, Children.LEAF), name, handler.getBundleName(), *************** *** 172,179 **** handler.getTooltipKey(), handler.getIcon16URL(), handler.getIcon32URL(), ! ic ! ); } } --- 173,187 ---- handler.getTooltipKey(), handler.getIcon16URL(), handler.getIcon32URL(), ! ic ) ! : new PaletteItemNode( ! new DataNode(xmlDataObject, Children.LEAF), ! name, ! handler.getDisplayName(), ! handler.getTooltip(), ! handler.getIcon16URL(), ! handler.getIcon32URL(), ! ic ); } } Index: src/org/netbeans/modules/palette/PaletteItemNode.java *** D:\projects\nb\core\palette\src\org\netbeans\modules\palette\PaletteItemNode.java Base (1.9) --- D:\projects\nb\core\palette\src\org\netbeans\modules\palette\PaletteItemNode.java Locally Modified (Based On 1.9) *************** *** 83,88 **** --- 83,110 ---- this.icon32URL = icon32URL; } + PaletteItemNode(DataNode original, + String name, + String displayName, + String tooltip, + String icon16URL, + String icon32URL, + InstanceContent content) + { + super(original, Children.LEAF, new AbstractLookup(content)); + + content.add( this ); + this.name = name; + this.bundleName = bundleName; + assert null != displayName; + this.displayName = displayName; + this.description = tooltip; + if( null == this.description ) + description = displayName; + this.icon16URL = icon16URL; + this.icon32URL = icon32URL; + } + public String getName() { return name; } Index: src/org/netbeans/modules/palette/PaletteItemHandler.java *** D:\projects\nb\core\palette\src\org\netbeans\modules\palette\PaletteItemHandler.java Base (1.5) --- D:\projects\nb\core\palette\src\org\netbeans\modules\palette\PaletteItemHandler.java Locally Modified (Based On 1.5) *************** *** 47,52 **** --- 47,55 ---- private static final String ATTR_URL = "urlvalue"; // NOI18N private static final String TAG_ICON32 = "icon32"; // NOI18N private static final String TAG_DESCRIPTION = "description"; // NOI18N + private static final String TAG_INLINE_DESCRIPTION = "inline-description"; // NOI18N + private static final String TAG_DISPLAY_NAME = "display-name"; // NOI18N + private static final String TAG_TOOLTIP = "tooltip"; // NOI18N private static final String ATTR_BUNDLE = "localizing-bundle"; // NOI18N private static final String ATTR_DISPLAY_NAME_KEY = "display-name-key"; // NOI18N private static final String ATTR_TOOLTIP_KEY = "tooltip-key"; // NOI18N *************** *** 64,70 **** --- 67,77 ---- private String bundleName; private String displayNameKey; private String tooltipKey; + private String displayName; + private String tooltip; + private StringBuffer textBuffer; + // public Map getAttributes() { return (attributeMap == null ? new HashMap() : attributeMap); } public String getBody() { return body; } public String getClassName() { return className; } *************** *** 74,79 **** --- 81,88 ---- public String getBundleName() { return bundleName; } public String getDisplayNameKey() { return displayNameKey; } public String getTooltipKey() { return tooltipKey; } + public String getDisplayName() { return displayName; } + public String getTooltip() { return tooltip; } public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException *************** *** 84,90 **** String message = NbBundle.getBundle(PaletteItemHandler.class) .getString("MSG_UnknownEditorPaletteItemVersion"); // NOI18N throw new SAXException(message); ! } else if (!"1.0".equals(version)) { // NOI18N String message = NbBundle.getBundle(PaletteItemHandler.class) .getString("MSG_UnsupportedEditorPaletteItemVersion"); // NOI18N throw new SAXException(message); --- 93,99 ---- String message = NbBundle.getBundle(PaletteItemHandler.class) .getString("MSG_UnknownEditorPaletteItemVersion"); // NOI18N throw new SAXException(message); ! } else if (!("1.0".equals(version) || "1.1".equals(version))) { // NOI18N String message = NbBundle.getBundle(PaletteItemHandler.class) .getString("MSG_UnsupportedEditorPaletteItemVersion"); // NOI18N throw new SAXException(message); *************** *** 110,116 **** --- 119,134 ---- bundleName = attributes.getValue(ATTR_BUNDLE); displayNameKey = attributes.getValue(ATTR_DISPLAY_NAME_KEY); tooltipKey = attributes.getValue(ATTR_TOOLTIP_KEY); + } else if (TAG_INLINE_DESCRIPTION.equals(qName)) { + bundleName = null; + displayNameKey = null; + tooltipKey = null; + } else if (TAG_DISPLAY_NAME.equals(qName)) { + textBuffer = new StringBuffer(); + } else if (TAG_TOOLTIP.equals(qName)) { + textBuffer = new StringBuffer(); } + System.err.println( "<" + qName ); } public void endElement(String uri, String localName, String qName) throws SAXException { *************** *** 118,124 **** --- 136,149 ---- if (TAG_BODY.equals(qName)) { insideBody = false; body = trimSurroundingLines(bodyLines); + } else if( TAG_DISPLAY_NAME.equals(qName) ) { + displayName = textBuffer.toString(); + textBuffer = null; + } else if( TAG_TOOLTIP.equals(qName) ) { + tooltip = textBuffer.toString(); + textBuffer = null; } + System.err.println( qName + ">" ); } public void characters(char buf[], int offset, int len) *************** *** 127,132 **** --- 152,159 ---- if (insideBody) { String chars = new String(buf, offset, len).trim(); bodyLines.add(chars + "\n"); + } else if( null != textBuffer ) { + textBuffer.append( buf, offset, len ); } }