void (final Project project, final ComponentItem itemToBeAdded) { Palette palette = Palette.getInstance(project); if (itemToBeAdded.getIconPath() == null || itemToBeAdded.getIconPath().length() == 0) { PsiClass aClass = JavaPsiFacade.getInstance(project).findClass(itemToBeAdded.getClassName().replace('$', '.'), ProjectScope.getAllScope(project)); while (aClass != null) { String name = aClass.getQualifiedName(); ComponentItem item = name == null ? null : palette.getItem(name); if (item != null) { String iconPath = item.getIconPath(); if (iconPath != null && iconPath.length() > 0) { itemToBeAdded.setIconPath(iconPath); return; } } aClass = aClass.getSuperClass(); } } }