Skip to content

Commit

Permalink
Merge pull request #17 from yoichi/JENKINS-19698
Browse files Browse the repository at this point in the history
[FIXED JENKINS-19698] add context menu on breadcrumb list
  • Loading branch information
ctapobep committed Nov 23, 2013
2 parents 1be9638 + 2e4d068 commit 455e74d
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/main/java/hudson/plugins/nested_view/NestedView.java
Expand Up @@ -32,6 +32,8 @@
import hudson.util.FormValidation;
import hudson.views.ListViewColumn;
import hudson.views.ViewsTabBar;
import jenkins.model.ModelObjectWithContextMenu;
import org.apache.commons.jelly.JellyException;
import org.kohsuke.stapler.*;
import org.kohsuke.stapler.export.Exported;

Expand All @@ -50,7 +52,7 @@
* @author Kohsuke Kawaguchi
* @author Romain Seguy
*/
public class NestedView extends View implements ViewGroup, StaplerProxy {
public class NestedView extends View implements ViewGroup, StaplerProxy, ModelObjectWithContextMenu {
private final static Result WORST_RESULT = Result.FAILURE;

/**
Expand All @@ -77,6 +79,18 @@ public boolean contains(TopLevelItem item) {
return false;
}

public ContextMenu doContextMenu(StaplerRequest request, StaplerResponse response) throws IOException, JellyException {
return new ContextMenu().from(this, request, response);
}

public ContextMenu doChildrenContextMenu(StaplerRequest request, StaplerResponse response) throws Exception {
ContextMenu menu = new ContextMenu();
for (View view : getViews()) {
menu.add(new MenuItem().withContextRelativeUrl(view.getUrl()).withDisplayName(view.getDisplayName()));
}
return menu;
}

@Override
public String getUrl() {
return getViewUrl();
Expand Down

0 comments on commit 455e74d

Please sign in to comment.