sdedic opened a new pull request #3414:
URL: https://github.com/apache/netbeans/pull/3414


   This PR allows LSP clients to "rebrand" or alter icons supplied byt he NBLS 
server for exported nodes. It's not exactly branding, since the LSP client may 
have its own ideas or icon schemes that do not fit to the NB Node 
implementations - which shall not be affected at all. The vscode client, in 
addition, uses fontified icons (bcs they scale), which more or less prevent 
branding - except maybe if I'd extract the font glyphs (possible license 
issues) and converted them to SVG branding resources.
   
   Instead, the URL of the image's resource will be extracted from Node's icon 
and transmitted. As it acts like an unique ID (not exactly, see notes below), 
the client may replace it with its own icon. Icons that are the same on NB side 
(NB design) may be matched and replaced based on `contextValue` or `name` 
exported node's metadata (which is actually more powerful than just branding). 
Branding can be still used, if appropriate.
   
   Note that certain prominent icons **do not come from URL resources**, but 
from `UIManager.getDefaults()` - the exact shape is defined by LaF. So these 
icons either do not have URLs at all, or their URLs differ between LaFs, which 
is unfortunate if the LaF-specific URL was used an ID.
   
   The 1st commit in this PR changes openide `ImageUtilities`, it's probably 
the most important one from this PR.
   * Images and icons produced by `ImageUtilities` maintain not only `url` (see 
`Image.getProperty` API) but also `uri`. As `url` property must be typed as 
URL, and non-location IDs cannot be represented as URLs (no URLStreamHandler 
registered, and the underlying resource bits are really not known) - another 
property is invented. Since the URI syntax is more flexible, even badges or 
filters can be represented as URIs (see at the end) in the future.
   
   * During implementation it turned out that if `ToolkitImage` is wrapped in a 
delegating Image instance weird things happen: the SurfaceManager is not 
initialized properly so an attempt to `graphics.drawImage` will fail with 
`IllegalArgumentException`. So super-hacky `originalImage` or `originalIcon` 
backdoor is invented instead - so the anticipated delegating implementation may 
pass the surface-compatible real image as appropriate.
   
   This part of impl is not finished: IMHO some convenience accessor methods 
for the URL (already was there) and URI should be added to `ImageUtilities`, 
the URI of regular resource-based icons should **not** be affected by branding 
or localization (it is now) and eventual badges should be somehow accessible as 
`URI[]` and also the possibly applied filter od disabled icon filter...
   That's why I did not (yet) documented the added properties in `arch.xml`. I 
plan to do so after the implementation proves worthy hopefuly before NB13 
finalizes.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to