You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@netbeans.apache.org by Andreas Sewe <se...@cqse.eu> on 2018/07/31 11:52:10 UTC

How to get the default icon for a MIME type?

Hi,

is there a way to get the plain, unadorned icon for a FileObject's MIME
type?

Going through DataNode.find(fileObject).getNodeDelegate().getIcon(type)
produces an icon with badges, which is something I don't want as these
badges may distract the user; the user should see plainly that it's a
text/x-java file, but whether there are compile errors in it is
immaterial in this context.

Directly accessing the system file system with
FileUtil.getSystemConfigFile("Loaders/" + fileObject.getMIMEType()) and
then looking for the "SystemFileSystem.icon" or "iconBase" attributes
doesn't work for me. Neither attribute is present, although I can see
them in the layer.xml. Maybe this is because "Loaders/text/x-java" is a
folder rather than a file? Or am I simply doing something wrong?

Any help with this is greatly appreciated. In particular, advice about
possible performance gotchas is probably needed as well, as I want to
return the resulting Image from AbstractNode.getIcon, which seems to be
called very frequently.

Best wishes,

Andreas

-- 
Dr. Andreas Sewe | sewe@cqse.eu | +49 152 56342856
CQSE GmbH | Lichtenbergstrasse 8 | 85748 Garching | www.cqse.eu
Amtsgericht Muenchen | HRB 177678 | GF: F. Deissenboeck, M. Feilkas