Icon () { // Check cached value first if (myIcon != null) { return myIcon; } // Create new icon if (myIconPath != null && myIconPath.length() > 0) { final VirtualFile iconFile = ResourceFileUtil.findResourceFileInScope(myIconPath, myProject, GlobalSearchScope.allScope(myProject)); if (iconFile != null) { try { myIcon = new ImageIcon(iconFile.contentsToByteArray()); } catch (IOException e) { myIcon = null; } } else { myIcon = IconLoader.findIcon(myIconPath, ComponentItem.class.getClassLoader()); } } if (myIcon == null) { myIcon = UIDesignerIcons.Unknown; } return myIcon; }