allowed images to be loaded from plugins.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@2662 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2007-03-25 23:50:35 +00:00
1 parent 426a968660
commit fbad52ef18
4 files changed
+26 -4

No files matched your search

+13
View File
@@ -8,6 +8,7 @@ import hudson.model.Run;
import hudson.model.Items;
import hudson.model.JobPropertyDescriptor;
import hudson.model.Job;
import hudson.model.Action;
import org.kohsuke.stapler.Ancestor;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
@@ -353,4 +354,16 @@ public class Functions {
public static List<JobPropertyDescriptor> getJobPropertyDescriptors(Class<? extends Job> clazz) {
return JobPropertyDescriptor.getPropertyDescriptors(clazz);
}
/**
* Computes the path to the icon of the given action
* from the context path.
*/
public static String getIconFilePath(Action a) {
String name = a.getIconFileName();
if(name.startsWith("/"))
return name.substring(1);
else
return "images/24x24/"+name;
}
}