File D:\maven-qcr-plugin-testsunitaires\qcr4java\jenkins-master\target\site\qc\ui-samples-plugin\src\main\java\jenkins\plugins\ui_samples\NavigationContextMenu.java.html

1 package jenkins.plugins.ui_samples;
2
3 import hudson.Extension;
4 import jenkins.model.ModelObjectWithContextMenu;
5 import org.kohsuke.stapler.StaplerRequest;
6 import org.kohsuke.stapler.StaplerResponse;
7
8 import java.util.List;
9
10 /**
11 * @author Kohsuke Kawaguchi
12 */
13 @Extension
14 public class NavigationContextMenu extends UISample implements ModelObjectWithContextMenu {
15 @Override
16 public String getDescription() {
17 return "Integrate with navigational context menu to provider quick access around object graph";
18 }
19
20 /**
21 * This method is called via AJAX to obtain the context menu for this model object.
22 */
23 public ContextMenu doContextMenu(StaplerRequest request, StaplerResponse response) throws Exception {
24 if (false) {
25 // this implementation is suffice for most ModelObjects. It uses sidepanel.jelly/.groovy to
26 // generate the context menu
27 return new ContextMenu().from(this,request,response);
28 } else {
29 // otherwise you can also programatically create them.
30 // see the javadoc for various convenience methods to add items
31 return new ContextMenu()
32 .add("http://jenkins-ci.org/","Jenkins project")
33 .add("http://www.cloudbees.com/","CloudBees")
34 .add(request.getContextPath(),"/images/24x24/gear.png","top-page");
35 }
36 }
37
38 @Extension
39 public static final class DescriptorImpl extends UISampleDescriptor {
40 }
41 }
42
43
44