diff --git a/src/main/java/org/jenkinsci/plugins/schedulebuild/ScheduleBuildButtonColumn.java b/src/main/java/org/jenkinsci/plugins/schedulebuild/ScheduleBuildButtonColumn.java index e62e5a0..61773be 100644 --- a/src/main/java/org/jenkinsci/plugins/schedulebuild/ScheduleBuildButtonColumn.java +++ b/src/main/java/org/jenkinsci/plugins/schedulebuild/ScheduleBuildButtonColumn.java @@ -2,12 +2,19 @@ import hudson.Extension; import hudson.model.Descriptor; +import hudson.model.Job; +import hudson.model.TopLevelItem; import hudson.views.ListViewColumn; import hudson.views.ListViewColumnDescriptor; import net.sf.json.JSONObject; import org.kohsuke.stapler.StaplerRequest; public class ScheduleBuildButtonColumn extends ListViewColumn { + + public boolean isBuildable(TopLevelItem item) { + return item instanceof Job; + } + public static final class DescriptorImpl extends ListViewColumnDescriptor { @Override public String getDisplayName() { diff --git a/src/main/java/org/jenkinsci/plugins/schedulebuild/ScheduleBuildTransientProjectActionFactory.java b/src/main/java/org/jenkinsci/plugins/schedulebuild/ScheduleBuildTransientProjectActionFactory.java index 90809f2..5e7dbe3 100644 --- a/src/main/java/org/jenkinsci/plugins/schedulebuild/ScheduleBuildTransientProjectActionFactory.java +++ b/src/main/java/org/jenkinsci/plugins/schedulebuild/ScheduleBuildTransientProjectActionFactory.java @@ -3,6 +3,7 @@ import hudson.Extension; import hudson.model.Action; import hudson.model.Job; +import hudson.model.TopLevelItem; import java.util.Collection; import java.util.Collections; import jenkins.model.TransientActionFactory; @@ -17,6 +18,10 @@ public Class type() { @Override public Collection createFor(Job target) { - return Collections.singleton(new ScheduleBuildAction(target)); + if (target instanceof TopLevelItem) { + return Collections.singleton(new ScheduleBuildAction(target)); + } else { + return Collections.emptyList(); + } } } diff --git a/src/main/resources/org/jenkinsci/plugins/schedulebuild/ScheduleBuildButtonColumn/column.jelly b/src/main/resources/org/jenkinsci/plugins/schedulebuild/ScheduleBuildButtonColumn/column.jelly index 6556121..0210b34 100644 --- a/src/main/resources/org/jenkinsci/plugins/schedulebuild/ScheduleBuildButtonColumn/column.jelly +++ b/src/main/resources/org/jenkinsci/plugins/schedulebuild/ScheduleBuildButtonColumn/column.jelly @@ -1,7 +1,7 @@ - +