diff --git a/core/src/main/java/hudson/model/Hudson.java b/core/src/main/java/hudson/model/Hudson.java index f576487db5616231aa85e7d38a4a436023164f12..b9fa56a9fc90327a6a3570718ea9782f321dab65 100644 --- a/core/src/main/java/hudson/model/Hudson.java +++ b/core/src/main/java/hudson/model/Hudson.java @@ -273,6 +273,12 @@ public final class Hudson extends View implements ItemGroup, Node, public transient final ServletContext servletContext; + /** + * Transient action list. Useful for adding navigation items to the navigation bar + * on the left. + */ + private transient final List actions = new CopyOnWriteArrayList(); + public static Hudson getInstance() { return theInstance; } @@ -542,6 +548,26 @@ public final class Hudson extends View implements ItemGroup, Node, return ""; } + /** + * Returns the transient {@link Action}s associated with the top page. + * + *

+ * Adding {@link Action} is primarily useful for plugins to contribute + * an item to the navigation bar of the top page. See existing {@link Action} + * implementation for it affects the GUI. + * + *

+ * To register an {@link Action}, write code like + * {@code Hudson.getInstance().getActions().add(...)} + * + * @return + * Live list where the changes can be made. Can be empty but never null. + * @since 1.172 + */ + public List getActions() { + return actions; + } + /** * Gets just the immediate children of {@link Hudson}. *