本文整理了Java中hudson.Functions.getIconFilePath()
方法的一些代码示例,展示了Functions.getIconFilePath()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Functions.getIconFilePath()
方法的具体详情如下:
包路径:hudson.Functions
类名称:Functions
方法名:getIconFilePath
[英]Computes the path to the icon of the given action from the context path.
[中]从上下文路径计算给定操作图标的路径。
代码示例来源:origin: jenkinsci/jenkins
/**
* @see ContextMenuVisibility
*/
public ContextMenu add(Action a) {
if (!Functions.isContextMenuVisible(a)) {
return this;
}
StaplerRequest req = Stapler.getCurrentRequest();
String text = a.getDisplayName();
String base = Functions.getIconFilePath(a);
if (base==null) return this;
String icon = Stapler.getCurrentRequest().getContextPath()+(base.startsWith("images/")?Functions.getResourcePath():"")+'/'+base;
String url = Functions.getActionUrl(req.findAncestor(ModelObject.class).getUrl(),a);
return add(url,icon,text);
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* @see ContextMenuVisibility
*/
public ContextMenu add(Action a) {
if (!Functions.isContextMenuVisible(a)) {
return this;
}
StaplerRequest req = Stapler.getCurrentRequest();
String text = a.getDisplayName();
String base = Functions.getIconFilePath(a);
if (base==null) return this;
String icon = Stapler.getCurrentRequest().getContextPath()+(base.startsWith("images/")?Functions.getResourcePath():"")+'/'+base;
String url = Functions.getActionUrl(req.findAncestor(ModelObject.class).getUrl(),a);
return add(url,icon,text);
}
代码示例来源:origin: org.jenkins-ci.plugins/credentials
/**
* Adds a menu item for the specified action with the supplied prefix offset and optional sub menu.
*
* @param menu the menu to add to.
* @param prefix the prefix offset of the action urls.
* @param action the action.
* @param subMenu the sub menu.
*/
public static void addMenuItem(@NonNull ModelObjectWithContextMenu.ContextMenu menu,
@CheckForNull String prefix, @NonNull Action action,
@CheckForNull ModelObjectWithContextMenu.ContextMenu subMenu) {
if (isContextMenuVisible(action) && action.getIconFileName() != null) {
Icon icon = action instanceof IconSpec ? ContextMenuIconUtils.getIcon(action) : null;
String base = icon != null ? ContextMenuIconUtils.getQualifiedUrl(icon) : Functions.getIconFilePath(action);
ModelObjectWithContextMenu.MenuItem item = new ModelObjectWithContextMenu.MenuItem(
ContextMenuIconUtils.buildUrl(prefix, action.getUrlName()),
ContextMenuIconUtils.getMenuItemIconUrl(base),
action.getDisplayName()
);
item.subMenu = subMenu;
menu.add(item);
}
}
/** TODO copied from {@link Functions} but currently restricted */
代码示例来源:origin: jenkinsci/credentials-plugin
/**
* Adds a menu item for the specified action with the supplied prefix offset and optional sub menu.
*
* @param menu the menu to add to.
* @param prefix the prefix offset of the action urls.
* @param action the action.
* @param subMenu the sub menu.
*/
public static void addMenuItem(@NonNull ModelObjectWithContextMenu.ContextMenu menu,
@CheckForNull String prefix, @NonNull Action action,
@CheckForNull ModelObjectWithContextMenu.ContextMenu subMenu) {
if (isContextMenuVisible(action) && action.getIconFileName() != null) {
Icon icon = action instanceof IconSpec ? ContextMenuIconUtils.getIcon(action) : null;
String base = icon != null ? ContextMenuIconUtils.getQualifiedUrl(icon) : Functions.getIconFilePath(action);
ModelObjectWithContextMenu.MenuItem item = new ModelObjectWithContextMenu.MenuItem(
ContextMenuIconUtils.buildUrl(prefix, action.getUrlName()),
ContextMenuIconUtils.getMenuItemIconUrl(base),
action.getDisplayName()
);
item.subMenu = subMenu;
menu.add(item);
}
}
/** TODO copied from {@link Functions} but currently restricted */
内容来源于网络,如有侵权,请联系作者删除!