提交 fd772948 编写于 作者: J Jesse Glick

Pulling doChildrenContextMenu up from AbstractProject into Job, since the...

Pulling doChildrenContextMenu up from AbstractProject into Job, since the latter already defines permalinks.
上级 e23599a0
......@@ -45,7 +45,6 @@ import hudson.model.Cause.LegacyCodeCause;
import hudson.model.Descriptor.FormException;
import hudson.model.Fingerprint.RangeSet;
import hudson.model.Node.Mode;
import hudson.model.PermalinkProjectAction.Permalink;
import hudson.model.Queue.Executable;
import hudson.model.Queue.Task;
import hudson.model.labels.LabelAtom;
......@@ -109,7 +108,6 @@ import javax.annotation.Nonnull;
import javax.servlet.ServletException;
import jenkins.model.Jenkins;
import jenkins.model.JenkinsLocationConfiguration;
import jenkins.model.ModelObjectWithChildren;
import jenkins.model.ParameterizedJobMixIn;
import jenkins.model.Uptime;
import jenkins.model.lazy.LazyBuildMixIn;
......@@ -143,7 +141,7 @@ import org.kohsuke.stapler.interceptor.RequirePOST;
* @see AbstractBuild
*/
@SuppressWarnings("rawtypes")
public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>> extends Job<P,R> implements BuildableItem, ModelObjectWithChildren, LazyBuildMixIn.LazyLoadingJob<P,R>, ParameterizedJobMixIn.ParameterizedJob {
public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>> extends Job<P,R> implements BuildableItem, LazyBuildMixIn.LazyLoadingJob<P,R>, ParameterizedJobMixIn.ParameterizedJob {
/**
* {@link SCM} associated with the project.
......@@ -1865,17 +1863,6 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
return r;
}
public ContextMenu doChildrenContextMenu(StaplerRequest request, StaplerResponse response) throws Exception {
// not sure what would be really useful here. This needs more thoughts.
// for the time being, I'm starting with permalinks
ContextMenu menu = new ContextMenu();
for (Permalink p : getPermalinks()) {
if (p.resolve(this)!=null)
menu.add(p.getId(),p.getDisplayName());
}
return menu;
}
/**
* Serves the workspace files.
*/
......
......@@ -100,6 +100,7 @@ import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import static javax.servlet.http.HttpServletResponse.*;
import jenkins.model.ModelObjectWithChildren;
import jenkins.model.lazy.LazyBuildMixIn;
/**
......@@ -114,7 +115,7 @@ import jenkins.model.lazy.LazyBuildMixIn;
* @author Kohsuke Kawaguchi
*/
public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, RunT>>
extends AbstractItem implements ExtensionPoint, StaplerOverridable, OnMaster {
extends AbstractItem implements ExtensionPoint, StaplerOverridable, ModelObjectWithChildren, OnMaster {
/**
* Next build number. Kept in a separate file because this is the only
......@@ -998,6 +999,18 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
return permalinks;
}
@Override public ContextMenu doChildrenContextMenu(StaplerRequest request, StaplerResponse response) throws Exception {
// not sure what would be really useful here. This needs more thoughts.
// for the time being, I'm starting with permalinks
ContextMenu menu = new ContextMenu();
for (Permalink p : getPermalinks()) {
if (p.resolve(this) != null) {
menu.add(p.getId(), p.getDisplayName());
}
}
return menu;
}
/**
* Used as the color of the status ball for the project.
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册