/** * Get the Item's Icon class specification e.g. 'icon-notepad'. * <p> * Note: do <strong>NOT</strong> include icon size specifications (such as 'icon-sm'). * * @return The Icon class specification e.g. 'icon-notepad'. */ @Override public String getIconClassName() { // Oh the fun of somebody adding a legacy way of referencing images into 2.0 code String pattern = getIconFilePathPattern(); if (pattern != null) { // here we go with the dance of the IconSet's String path = pattern.replace(":size", "24x24"); // we'll strip the icon-md to get the class name if (path.indexOf('/') == -1) { // this one is easy... too easy... also will never happen return IconSet.toNormalizedIconNameClass(path); } if (Jenkins.RESOURCE_PATH.length() > 0 && path.startsWith(Jenkins.RESOURCE_PATH)) { // will to live falling path = path.substring(Jenkins.RESOURCE_PATH.length()); } Icon icon = IconSet.icons.getIconByUrl(path); if (icon != null) { return icon.getClassSpec().replaceAll("\\s*icon-md\\s*", " ").replaceAll("\\s+", " "); } } return null; }
/** * Get an icon instance from it's url. * @param url The icon url. * @return The icon instance, or {@code null} if no such icon. */ public Icon getIconByUrl(GString url) { if (url == null) { return null; } return getIconByUrl(url.toString()); }
/** * Get the Item's Icon class specification e.g. 'icon-notepad'. * <p> * Note: do <strong>NOT</strong> include icon size specifications (such as 'icon-sm'). * * @return The Icon class specification e.g. 'icon-notepad'. */ @Override public String getIconClassName() { // Oh the fun of somebody adding a legacy way of referencing images into 2.0 code String pattern = getIconFilePathPattern(); if (pattern != null) { // here we go with the dance of the IconSet's String path = pattern.replace(":size", "24x24"); // we'll strip the icon-md to get the class name if (path.indexOf('/') == -1) { // this one is easy... too easy... also will never happen return IconSet.toNormalizedIconNameClass(path); } if (Jenkins.RESOURCE_PATH.length() > 0 && path.startsWith(Jenkins.RESOURCE_PATH)) { // will to live falling path = path.substring(Jenkins.RESOURCE_PATH.length()); } Icon icon = IconSet.icons.getIconByUrl(path); if (icon != null) { return icon.getClassSpec().replaceAll("\\s*icon-md\\s*", " ").replaceAll("\\s+", " "); } } return null; }
icon = IconSet.icons.getIconByUrl(action.getIconFileName());
icon = IconSet.icons.getIconByUrl(action.getIconFileName());