hudson.model.Hudson.getActions()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(160)

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

Hudson.getActions介绍

[英]Returns the transient Actions associated with the top page.

Adding Action is primarily useful for plugins to contribute an item to the navigation bar of the top page. See existing Actionimplementation for it affects the GUI.

To register an Action, implement RootAction extension point, or write code like Hudson.getInstance().getActions().add(...).
[中]返回与顶部页面关联的临时操作。
添加操作对于插件将项目添加到首页的导航栏非常有用。请参阅现有的Actionimplementation,因为它会影响GUI。
要注册操作,请实现RootAction扩展点,或者编写类似Hudson的代码。getInstance()。getActions()。添加(…)。

代码示例

代码示例来源:origin: jenkinsci/build-failure-analyzer-plugin

/**
 * Provides the singleton instance of this class that Jenkins has loaded. Throws an IllegalStateException if for
 * some reason the action can't be found.
 *
 * @return the instance.
 */
public static CauseManagement getInstance() {
  for (Action action : Hudson.getInstance().getActions()) {
    if (action instanceof CauseManagement) {
      return (CauseManagement)action;
    }
  }
  throw new IllegalStateException("We seem to not have been initialized!");
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
 * Returns the transient {@link Action}s associated with the top page.
 *
 * <p>
 * If views don't want to show top-level actions, this method
 * can be overridden to return different objects.
 *
 * @see Hudson#getActions()
 */
public List<Action> getActions() {
  List<Action> result = new ArrayList<Action>();
  result.addAll(Hudson.getInstance().getActions());
  synchronized (this) {
    if (transientActions == null) {
      transientActions = TransientViewActionFactory.createAllFor(this); 
    }
    result.addAll(transientActions);
  }
  return result;
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

/**
 * Returns the transient {@link Action}s associated with the top page.
 *
 * <p> If views don't want to show top-level actions, this method can be
 * overridden to return different objects.
 *
 * @see Hudson#getActions()
 */
public List<Action> getActions() {
  List<Action> result = new ArrayList<Action>();
  result.addAll(Hudson.getInstance().getActions());
  synchronized (this) {
    if (transientActions == null) {
      transientActions = TransientViewActionFactory.createAllFor(this);
    }
    result.addAll(transientActions);
  }
  return result;
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
 * Returns the transient {@link Action}s associated with the top page.
 *
 * <p>
 * If views don't want to show top-level actions, this method
 * can be overridden to return different objects.
 *
 * @see Hudson#getActions()
 */
public List<Action> getActions() {
  List<Action> result = new ArrayList<Action>();
  result.addAll(Hudson.getInstance().getActions());
  synchronized (this) {
    if (transientActions == null) {
      transientActions = TransientViewActionFactory.createAllFor(this); 
    }
    result.addAll(transientActions);
  }
  return result;
}

代码示例来源:origin: hudson/hudson-2.x

/**
 * Returns the transient {@link Action}s associated with the top page.
 *
 * <p>
 * If views don't want to show top-level actions, this method
 * can be overridden to return different objects.
 *
 * @see Hudson#getActions()
 */
public List<Action> getActions() {
  List<Action> result = new ArrayList<Action>();
  result.addAll(Hudson.getInstance().getActions());
  synchronized (this) {
    if (transientActions == null) {
      transientActions = TransientViewActionFactory.createAllFor(this); 
    }
    result.addAll(transientActions);
  }
  return result;
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

public Object getDynamic(String token) {
  for (Action a : getActions()) {
    if (a.getUrlName().equals(token) || a.getUrlName().equals('/' + token)) {
      return a;
    }
  }
  for (Action a : getManagementLinks()) {
    if (a.getUrlName().equals(token)) {
      return a;
    }
  }
  return null;
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

public Object getDynamic(String token) {
  for (Action a : getActions()) {
    if (a.getUrlName().equals(token) || a.getUrlName().equals('/' + token)) {
      return a;
    }
  }
  for (Action a : getManagementLinks()) {
    if (a.getUrlName().equals(token)) {
      return a;
    }
  }
  return null;
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

public Object getDynamic(String token) {
  for (Action a : getActions()) {
    if (a.getUrlName().equals(token) || a.getUrlName().equals('/' + token)) {
      return a;
    }
  }
  for (Action a : getManagementLinks()) {
    if (a.getUrlName().equals(token)) {
      return a;
    }
  }
  return null;
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
 * Decide if {@link WindowsInstallerLink} should show up in UI, and if so, register it.
 */
@Extension
public static ManagementLink registerIfApplicable() {
  if(!Functions.isWindows())
    return null; // this is a Windows only feature
  if(Lifecycle.get() instanceof WindowsServiceLifecycle)
    return null; // already installed as Windows service
  // this system property is set by the launcher when we run "java -jar hudson.war"
  // and this is how we know where is hudson.war.
  String war = System.getProperty("executable-war");
  if(war!=null && new File(war).exists()) {
    WindowsInstallerLink link = new WindowsInstallerLink(new File(war));
    // in certain situations where we know the user is just trying Hudson (like when Hudson is launched
    // from JNLP from https://hudson.java.net/), also put this link on the navigation bar to increase
    // visibility
    if(System.getProperty(WindowsInstallerLink.class.getName()+".prominent")!=null)
      Hudson.getInstance().getActions().add(link);
    return link;
  }
  return null;
}

代码示例来源:origin: hudson/hudson-2.x

public Object getDynamic(String token) {
  for (Action a : getActions()) {
    if (a.getUrlName().equals(token) || a.getUrlName().equals('/' + token)) {
      return a;
    }
  }
  for (Action a : getManagementLinks()) {
    if (a.getUrlName().equals(token)) {
      return a;
    }
  }
  return null;
}

代码示例来源:origin: hudson/hudson-2.x

/**
 * Decide if {@link WindowsInstallerLink} should show up in UI, and if so, register it.
 */
@Extension
public static ManagementLink registerIfApplicable() {
  if(!Functions.isWindows())
    return null; // this is a Windows only feature
  if(Lifecycle.get() instanceof WindowsServiceLifecycle)
    return null; // already installed as Windows service
  // this system property is set by the launcher when we run "java -jar hudson.war"
  // and this is how we know where is hudson.war.
  String war = System.getProperty("executable-war");
  if(war!=null && new File(war).exists()) {
    WindowsInstallerLink link = new WindowsInstallerLink(new File(war));
    // in certain situations where we know the user is just trying Hudson (like when Hudson is launched
    // from JNLP from https://hudson.java.net/), also put this link on the navigation bar to increase
    // visibility
    if(System.getProperty(WindowsInstallerLink.class.getName()+".prominent")!=null)
      Hudson.getInstance().getActions().add(link);
    return link;
  }
  return null;
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
 * Decide if {@link WindowsInstallerLink} should show up in UI, and if so, register it.
 */
@Extension
public static ManagementLink registerIfApplicable() {
  if(!Functions.isWindows())
    return null; // this is a Windows only feature
  if (Lifecycle.get() instanceof WindowsServiceLifecycle) {
    return null; // already installed as Windows service
  }
  // this system property is set by the launcher when we run "java -jar hudson.war"
  // and this is how we know where is hudson.war.
  String war = System.getProperty("executable-war");
  if (war != null && new File(war).exists()) {
    WindowsInstallerLink link = new WindowsInstallerLink(new File(war));
    // in certain situations where we know the user is just trying Hudson (like when Hudson is launched
    // from JNLP from https://hudson.java.net/), also put this link on the navigation bar to increase
    // visibility
    if (System.getProperty(WindowsInstallerLink.class.getName() + ".prominent") != null) {
      Hudson.getInstance().getActions().add(link);
    }
    return link;
  }
  return null;
}
private static final Logger LOGGER = Logger.getLogger(WindowsInstallerLink.class.getName());

代码示例来源:origin: org.eclipse.hudson/hudson-core

/**
 * Decide if {@link WindowsInstallerLink} should show up in UI, and if so,
 * register it.
 */
@Extension
public static ManagementLink registerIfApplicable() {
  if (!Functions.isWindows()) {
    return null; // this is a Windows only feature
  }
  if (Lifecycle.get() instanceof WindowsServiceLifecycle) {
    return null; // already installed as Windows service
  }
  // this system property is set by the launcher when we run "java -jar hudson.war"
  // and this is how we know where is hudson.war.
  String war = System.getProperty("executable-war");
  if (war != null && new File(war).exists()) {
    WindowsInstallerLink link = new WindowsInstallerLink(new File(war));
    // in certain situations where we know the user is just trying Hudson (like when Hudson is launched
    // from JNLP from https://hudson.java.net/), also put this link on the navigation bar to increase
    // visibility
    if (System.getProperty(WindowsInstallerLink.class.getName() + ".prominent") != null) {
      Hudson.getInstance().getActions().add(link);
    }
    return link;
  }
  return null;
}
private static final Logger LOGGER = Logger.getLogger(WindowsInstallerLink.class.getName());

代码示例来源:origin: org.eclipse.hudson/hudson-core

for (Action action : getActions()) {
  if (action instanceof UnsecuredRootAction) {
    if (rest.startsWith("/" + action.getUrlName() + "/")) {

代码示例来源:origin: org.jvnet.hudson.main/hudson-test-harness

hudson.getActions().add(this);

代码示例来源:origin: org.jvnet.hudson.main/hudson-test-framework

hudson.getActions().add(this);

代码示例来源:origin: org.eclipse.hudson/hudson-test-framework

hudson.getActions().add(this);

相关文章

Hudson类方法