Custom Language Support Tutorial Problem With Icon
I'm following the Custom Language Support Tutorial, and I'm already stuck at part 2.
The problem is that it won't load the Icon. I have copied everything from the shown code, and the .png file is in the correct location under com.simpleplugin.icons.
(When I hover over the path I provide in `IconLoader.getIcon(...)` while pressing `Shift` IntelliJ will display me the icon as well.)
The error I get is this:
java.lang.ExceptionInInitializerError
at com.simpleplugin.SimpleFileType.getIcon(SimpleFileType.java:40)
at com.intellij.ide.presentation.VirtualFilePresentation.getIconImpl(VirtualFilePresentation.java:46)
at com.intellij.util.IconUtil.getIcon(IconUtil.java:177)
at com.intellij.psi.impl.ElementBase.getElementIcon(ElementBase.java:227)
at com.intellij.psi.impl.ElementBase.doComputeIconNow(ElementBase.java:111)
....
I have no clue what to do. I tried using `ImageIcon` instead. I don't get any errors in that case, but neither is the icon displayed.
请先登录再写评论。
It is hard to tell what exactly is wrong, but my best guess is that you didn't put the icon in the resource folder but in the src-folder (next to your Java classes).
Here you can see my setup folder structure and where my icons reside: https://github.com/SeeSharpSoft/intellij-csv-validator/tree/master/src/main/resources/media/icons
And here they are loaded: https://github.com/SeeSharpSoft/intellij-csv-validator/blob/master/src/main/java/net/seesharpsoft/intellij/plugins/csv/CsvIconProvider.java