jenkins.model.Jenkins.getActions()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(202)

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

Jenkins.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 Jenkins.getInstance().getActions().add(...).
[中]返回与顶部页面关联的临时操作。
添加操作对于插件将项目添加到首页的导航栏非常有用。请参阅现有的Actionimplementation,因为它会影响GUI。
要注册操作,请实现RootAction扩展点,或者编写类似Jenkins的代码。getInstance()。getActions()。添加(…)。

代码示例

代码示例来源:origin: jenkinsci/jenkins

  1. public List<Action> getViewActions() {
  2. return getActions();
  3. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Returns actions that should be displayed in views.
  3. *
  4. * <p>
  5. * In this interface, the return value is used read-only. This doesn't prevent subtypes
  6. * from returning modifiable actions, however.
  7. *
  8. * @return
  9. * may be empty but never null; {@link Jenkins#getActions} by default
  10. * @see Actionable#getActions()
  11. * @since 1.417
  12. */
  13. default List<Action> getViewActions() {
  14. return Jenkins.getInstance().getActions();
  15. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Gets a list of unprotected root actions.
  3. * These URL prefixes should be exempted from access control checks by container-managed security.
  4. * Ideally would be synchronized with {@link #getTarget}.
  5. * @return a list of {@linkplain Action#getUrlName URL names}
  6. * @since 1.495
  7. */
  8. public Collection<String> getUnprotectedRootActions() {
  9. Set<String> names = new TreeSet<String>();
  10. names.add("jnlpJars"); // TODO cleaner to refactor doJnlpJars into a URA
  11. // TODO consider caching (expiring cache when actions changes)
  12. for (Action a : getActions()) {
  13. if (a instanceof UnprotectedRootAction) {
  14. String url = a.getUrlName();
  15. if (url == null) continue;
  16. names.add(url);
  17. }
  18. }
  19. return names;
  20. }

代码示例来源:origin: jenkinsci/jenkins

  1. public Object getDynamic(String token) {
  2. for (Action a : getActions()) {
  3. String url = a.getUrlName();
  4. if (url==null) continue;
  5. if (url.equals(token) || url.equals('/' + token))
  6. return a;
  7. }
  8. for (Action a : getManagementLinks())
  9. if (Objects.equals(a.getUrlName(), token))
  10. return a;
  11. return null;
  12. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Decide if {@link WindowsInstallerLink} should show up in UI, and if so, register it.
  3. */
  4. @Extension
  5. public static WindowsInstallerLink registerIfApplicable() {
  6. if(!Functions.isWindows())
  7. return null; // this is a Windows only feature
  8. if(Lifecycle.get() instanceof WindowsServiceLifecycle)
  9. return null; // already installed as Windows service
  10. // this system property is set by the launcher when we run "java -jar jenkins.war"
  11. // and this is how we know where is jenkins.war.
  12. String war = SystemProperties.getString("executable-war");
  13. if(war!=null && new File(war).exists()) {
  14. WindowsInstallerLink link = new WindowsInstallerLink(new File(war));
  15. // in certain situations where we know the user is just trying Jenkins (like when Jenkins is launched
  16. // from JNLP), also put this link on the navigation bar to increase
  17. // visibility
  18. if(SystemProperties.getString(WindowsInstallerLink.class.getName()+".prominent")!=null)
  19. Jenkins.getInstance().getActions().add(link);
  20. return link;
  21. }
  22. return null;
  23. }

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

  1. public List<Action> getViewActions() {
  2. return getActions();
  3. }

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

  1. /**
  2. * Returns actions that should be displayed in views.
  3. *
  4. * <p>
  5. * In this interface, the return value is used read-only. This doesn't prevent subtypes
  6. * from returning modifiable actions, however.
  7. *
  8. * @return
  9. * may be empty but never null; {@link Jenkins#getActions} by default
  10. * @see Actionable#getActions()
  11. * @since 1.417
  12. */
  13. default List<Action> getViewActions() {
  14. return Jenkins.getInstance().getActions();
  15. }

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

  1. /**
  2. * Gets a list of unprotected root actions.
  3. * These URL prefixes should be exempted from access control checks by container-managed security.
  4. * Ideally would be synchronized with {@link #getTarget}.
  5. * @return a list of {@linkplain Action#getUrlName URL names}
  6. * @since 1.495
  7. */
  8. public Collection<String> getUnprotectedRootActions() {
  9. Set<String> names = new TreeSet<String>();
  10. names.add("jnlpJars"); // TODO cleaner to refactor doJnlpJars into a URA
  11. // TODO consider caching (expiring cache when actions changes)
  12. for (Action a : getActions()) {
  13. if (a instanceof UnprotectedRootAction) {
  14. String url = a.getUrlName();
  15. if (url == null) continue;
  16. names.add(url);
  17. }
  18. }
  19. return names;
  20. }

代码示例来源:origin: jenkinsci/selenium-plugin

  1. @Override
  2. public void postInitialize() throws Exception {
  3. startHub();
  4. Jenkins.getInstance().getActions().add(this);
  5. }

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

  1. public Object getDynamic(String token) {
  2. for (Action a : getActions()) {
  3. String url = a.getUrlName();
  4. if (url==null) continue;
  5. if (url.equals(token) || url.equals('/' + token))
  6. return a;
  7. }
  8. for (Action a : getManagementLinks())
  9. if (Objects.equals(a.getUrlName(), token))
  10. return a;
  11. return null;
  12. }

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

  1. /**
  2. * Decide if {@link WindowsInstallerLink} should show up in UI, and if so, register it.
  3. */
  4. @Extension
  5. public static WindowsInstallerLink registerIfApplicable() {
  6. if(!Functions.isWindows())
  7. return null; // this is a Windows only feature
  8. if(Lifecycle.get() instanceof WindowsServiceLifecycle)
  9. return null; // already installed as Windows service
  10. // this system property is set by the launcher when we run "java -jar jenkins.war"
  11. // and this is how we know where is jenkins.war.
  12. String war = SystemProperties.getString("executable-war");
  13. if(war!=null && new File(war).exists()) {
  14. WindowsInstallerLink link = new WindowsInstallerLink(new File(war));
  15. // in certain situations where we know the user is just trying Jenkins (like when Jenkins is launched
  16. // from JNLP), also put this link on the navigation bar to increase
  17. // visibility
  18. if(SystemProperties.getString(WindowsInstallerLink.class.getName()+".prominent")!=null)
  19. Jenkins.getInstance().getActions().add(link);
  20. return link;
  21. }
  22. return null;
  23. }

代码示例来源:origin: jenkinsci/jenkinsfile-runner

  1. jenkins.getActions().add(this);

代码示例来源:origin: io.jenkins.jenkinsfile-runner/setup

  1. jenkins.getActions().add(this);

代码示例来源:origin: jenkinsci/jenkins-test-harness

  1. jenkins.getActions().add(this);

代码示例来源:origin: jenkinsci/jenkins-test-harness

  1. jenkins.getActions().add(this);

代码示例来源:origin: org.jenkins-ci.plugins/credentials

  1. actions = ((Actionable) context).getActions(CredentialsStoreAction.class);
  2. } else if (context instanceof Jenkins) {
  3. actions = Util.filter(((Jenkins) context).getActions(), CredentialsStoreAction.class);
  4. } else if (context instanceof User) {
  5. actions = Util.filter(((User) context).getTransientActions(), CredentialsStoreAction.class);

代码示例来源:origin: jenkinsci/credentials-plugin

  1. actions = ((Actionable) context).getActions(CredentialsStoreAction.class);
  2. } else if (context instanceof Jenkins) {
  3. actions = Util.filter(((Jenkins) context).getActions(), CredentialsStoreAction.class);
  4. } else if (context instanceof User) {
  5. actions = Util.filter(((User) context).getTransientActions(), CredentialsStoreAction.class);

相关文章

Jenkins类方法