hudson.model.Action.getDisplayName()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(104)

本文整理了Java中hudson.model.Action.getDisplayName()方法的一些代码示例,展示了Action.getDisplayName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Action.getDisplayName()方法的具体详情如下:
包路径:hudson.model.Action
类名称:Action
方法名:getDisplayName

Action.getDisplayName介绍

[英]Gets the string to be displayed. The convention is to capitalize the first letter of each word, such as "Test Result".
[中]获取要显示的字符串。惯例是将每个单词的第一个字母大写,如“测试结果”。

代码示例

代码示例来源: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: stackoverflow.com

new ChoiceRenderer<Action>() {
  @Override
  public Object getDisplayValue(Action object) {
    return object.getDisplayName(); //return any string describing the object
  }
}

代码示例来源:origin: org.jenkins-ci.plugins/pipeline-graph-analysis

for (Action a : node.getActions()) {
  if (!(a instanceof TimingAction)) {
    formatted.append("\n  -").append(a.getClass().getSimpleName()).append(' ').append(a.getDisplayName());

代码示例来源:origin: Diabol/delivery-pipeline-plugin

@SuppressWarnings("deprecation")
public static List<StaticAnalysisResult> getResults(AbstractBuild<?, ?> build) {
  if (build != null) {
    if (JenkinsUtil.isPluginInstalled(ANALYSIS_CORE_PLUGIN)) {
      List<StaticAnalysisResult> result = new ArrayList<>();
      for (Action action : build.getActions()) {
        if (AbstractResultAction.class.isInstance(action) || MavenResultAction.class.isInstance(action)) {
          @SuppressWarnings("rawtypes")
          final BuildResult r = ((ResultAction) action).getResult();
          result.add(new StaticAnalysisResult(
              action.getDisplayName(),
              build.getUrl() + action.getUrlName(),
              r.getNumberOfHighPriorityWarnings(),
              r.getNumberOfNormalPriorityWarnings(),
              r.getNumberOfLowPriorityWarnings()));
        }
      }
      return result;
    }
  }
  return Collections.emptyList();
}

代码示例来源: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 */

相关文章