* can override {@link ModelObjectWithContextMenu#doContextMenu(StaplerRequest, StaplerResponse)}
* directly to provide alternative semantics.
*/
public ContextMenu from(ModelObjectWithContextMenu self, StaplerRequest request, StaplerResponse response) throws JellyException, IOException {
WebApp webApp = WebApp.getCurrent();
final Script s = webApp.getMetaClass(self).getTearOff(JellyClassTearOff.class).findScript("sidepanel");
if (s!=null) {
JellyFacet facet = webApp.getFacet(JellyFacet.class);
request.setAttribute("taskTags",this); // <l:task> will look for this variable and populate us
request.setAttribute("mode","side-panel");
// run sidepanel but ignore generated HTML
facet.scriptInvoker.invokeScript(request,response,new Script() {
public Script compile() throws JellyException {
return this;
}
public void run(JellyContext context, XMLOutput output) throws JellyTagException {
Functions.initPageVariables(context);
s.run(context,output);
}
},self,new XMLOutput(new DefaultHandler()));
} else
if (self instanceof Actionable) {
// fallback