String (@Nullable Icon icon, @NotNull String prefix) { if (icon instanceof RetrievableIcon) { return getAccessibleName(((RetrievableIcon)icon).retrieveIcon(), prefix); } if (icon instanceof CompositeIcon) { StringBuilder b = new StringBuilder("composite icon: "); int count = ((CompositeIcon)icon).getIconCount(); for (int i = 0; i < count; i++) { b.append(getAccessibleName(((CompositeIcon)icon).getIcon(i), "")); if (i < count - 1) b.append(" & "); } return b.toString(); } if (icon instanceof CachedImageIcon) { String path = ((CachedImageIcon)icon).getOriginalPath(); if (path != null) { String[] split = path.split(Pattern.quote("/") + "|" + Pattern.quote("\\")); String name = split[split.length - 1]; return prefix + name.split(Pattern.quote("."))[0]; } } return prefix + "unknown"; }