Project view - file type icon customization
How do I set a different icon for a particular file type that has specific content?
Specifically, I'm trying to set a custom icon for an in-house XML file (similar to how the IDEA plugin icon is different than a regular XML file icon).
The file typically is located at a known place in the directory structure and has a known name, but ideally Id like to be able to check for the existence of an in-house XML element (so any *.xml file with the right contents will have the custom icon)
After a Google search, it looks like IconProvider has something to do with it, but I didnt find anything about how to register this new IconProvider with IDEA and I didnt see anything about checking the contents of the file.
What are the specifics for the icon (size, format and number of colors)?
Regards
Nick
Please sign in to leave a comment.
Hello Nick,
Yes, IconProvider is the right API in this case. The implementation is registered
as an extension in the iconProvider extension point. You need to check whether
the PSI element passed to your IconProvider is an XmlFile, and if it is,
use the XML PSI to check if you need to change the icon.
The icons are 16x16, the format and number of colors doesn't matter.
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
For everybody who likes example code, here is some that works for my plugin:
The icon has to be packaged as a resource into the plugin jar.
plugin.xml fragment: