本文整理了Java中jenkins.model.Jenkins.getActions()
方法的一些代码示例,展示了Jenkins.getActions()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jenkins.getActions()
方法的具体详情如下:
包路径:jenkins.model.Jenkins
类名称: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
public List<Action> getViewActions() {
return getActions();
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Returns actions that should be displayed in views.
*
* <p>
* In this interface, the return value is used read-only. This doesn't prevent subtypes
* from returning modifiable actions, however.
*
* @return
* may be empty but never null; {@link Jenkins#getActions} by default
* @see Actionable#getActions()
* @since 1.417
*/
default List<Action> getViewActions() {
return Jenkins.getInstance().getActions();
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Gets a list of unprotected root actions.
* These URL prefixes should be exempted from access control checks by container-managed security.
* Ideally would be synchronized with {@link #getTarget}.
* @return a list of {@linkplain Action#getUrlName URL names}
* @since 1.495
*/
public Collection<String> getUnprotectedRootActions() {
Set<String> names = new TreeSet<String>();
names.add("jnlpJars"); // TODO cleaner to refactor doJnlpJars into a URA
// TODO consider caching (expiring cache when actions changes)
for (Action a : getActions()) {
if (a instanceof UnprotectedRootAction) {
String url = a.getUrlName();
if (url == null) continue;
names.add(url);
}
}
return names;
}
代码示例来源:origin: jenkinsci/jenkins
public Object getDynamic(String token) {
for (Action a : getActions()) {
String url = a.getUrlName();
if (url==null) continue;
if (url.equals(token) || url.equals('/' + token))
return a;
}
for (Action a : getManagementLinks())
if (Objects.equals(a.getUrlName(), token))
return a;
return null;
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Decide if {@link WindowsInstallerLink} should show up in UI, and if so, register it.
*/
@Extension
public static WindowsInstallerLink 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 jenkins.war"
// and this is how we know where is jenkins.war.
String war = SystemProperties.getString("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 Jenkins (like when Jenkins is launched
// from JNLP), also put this link on the navigation bar to increase
// visibility
if(SystemProperties.getString(WindowsInstallerLink.class.getName()+".prominent")!=null)
Jenkins.getInstance().getActions().add(link);
return link;
}
return null;
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
public List<Action> getViewActions() {
return getActions();
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Returns actions that should be displayed in views.
*
* <p>
* In this interface, the return value is used read-only. This doesn't prevent subtypes
* from returning modifiable actions, however.
*
* @return
* may be empty but never null; {@link Jenkins#getActions} by default
* @see Actionable#getActions()
* @since 1.417
*/
default List<Action> getViewActions() {
return Jenkins.getInstance().getActions();
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Gets a list of unprotected root actions.
* These URL prefixes should be exempted from access control checks by container-managed security.
* Ideally would be synchronized with {@link #getTarget}.
* @return a list of {@linkplain Action#getUrlName URL names}
* @since 1.495
*/
public Collection<String> getUnprotectedRootActions() {
Set<String> names = new TreeSet<String>();
names.add("jnlpJars"); // TODO cleaner to refactor doJnlpJars into a URA
// TODO consider caching (expiring cache when actions changes)
for (Action a : getActions()) {
if (a instanceof UnprotectedRootAction) {
String url = a.getUrlName();
if (url == null) continue;
names.add(url);
}
}
return names;
}
代码示例来源:origin: jenkinsci/selenium-plugin
@Override
public void postInitialize() throws Exception {
startHub();
Jenkins.getInstance().getActions().add(this);
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
public Object getDynamic(String token) {
for (Action a : getActions()) {
String url = a.getUrlName();
if (url==null) continue;
if (url.equals(token) || url.equals('/' + token))
return a;
}
for (Action a : getManagementLinks())
if (Objects.equals(a.getUrlName(), token))
return a;
return null;
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Decide if {@link WindowsInstallerLink} should show up in UI, and if so, register it.
*/
@Extension
public static WindowsInstallerLink 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 jenkins.war"
// and this is how we know where is jenkins.war.
String war = SystemProperties.getString("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 Jenkins (like when Jenkins is launched
// from JNLP), also put this link on the navigation bar to increase
// visibility
if(SystemProperties.getString(WindowsInstallerLink.class.getName()+".prominent")!=null)
Jenkins.getInstance().getActions().add(link);
return link;
}
return null;
}
代码示例来源:origin: jenkinsci/jenkinsfile-runner
jenkins.getActions().add(this);
代码示例来源:origin: io.jenkins.jenkinsfile-runner/setup
jenkins.getActions().add(this);
代码示例来源:origin: jenkinsci/jenkins-test-harness
jenkins.getActions().add(this);
代码示例来源:origin: jenkinsci/jenkins-test-harness
jenkins.getActions().add(this);
代码示例来源:origin: org.jenkins-ci.plugins/credentials
actions = ((Actionable) context).getActions(CredentialsStoreAction.class);
} else if (context instanceof Jenkins) {
actions = Util.filter(((Jenkins) context).getActions(), CredentialsStoreAction.class);
} else if (context instanceof User) {
actions = Util.filter(((User) context).getTransientActions(), CredentialsStoreAction.class);
代码示例来源:origin: jenkinsci/credentials-plugin
actions = ((Actionable) context).getActions(CredentialsStoreAction.class);
} else if (context instanceof Jenkins) {
actions = Util.filter(((Jenkins) context).getActions(), CredentialsStoreAction.class);
} else if (context instanceof User) {
actions = Util.filter(((User) context).getTransientActions(), CredentialsStoreAction.class);
内容来源于网络,如有侵权,请联系作者删除!