Get default IDE icon for a file.
Hi All,
I have a file which may or may not exist on the file system. Can I obtain the default icon that IDE would show for this resource. I do not have its VirtualFile instance. I just have the file path.
Thanks
Devang Shah
Please sign in to leave a comment.
Maybe somthing like this:
FileTypeManager.getInstance().getFileTypeByExtension(]]>).getIcon()
Or even better:
FileTypeManager.getInstance().getFileTypeByFileName(]]>).getIcon()
I can get appropriate icon for a file. How can i get for a folder? Is it possible to get the same icon as shown in the project view? Like, if the folder is a Module, then get the icon for Module, if a source directory, then get its appropriate icon.
Hello Devang,
PsiDirectory.getIcon()
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
There is also getFileTypeByFile() method. If you have VirtualFile object, you may use:
FileTypeManager.getInstance().getFileTypeByFile(virtualFile).getIcon()