Search in sources :

Example 6 with ConsolePluginService

use of org.glassfish.admingui.plugin.ConsolePluginService in project Payara by payara.

the class PluginHandlers method calculateHelpUrl.

@Handler(id = "calculateHelpUrl", input = { @HandlerInput(name = "pluginId", type = String.class, required = true), @HandlerInput(name = "helpKey", type = String.class, required = true) }, output = { @HandlerOutput(name = "url", type = String.class) })
public static void calculateHelpUrl(HandlerContext handlerCtx) {
    String pluginId = (String) handlerCtx.getInputValue("pluginId");
    String helpKey = (String) handlerCtx.getInputValue("helpKey");
    ConsolePluginService cps = getPluginService(handlerCtx.getFacesContext());
    ClassLoader cl = cps.getModuleClassLoader(pluginId);
    // // Try the viewRoot locale first
    // String path = getHelpPathForResource(helpKey, handlerCtx.getFacesContext().getViewRoot().getLocale(), cl);
    // if (path == null) {
    // // Try the default locale
    // path = getHelpPathForResource(helpKey, Locale.getDefault(), cl);
    // 
    // // Default to en
    // if (path == null) {
    // path = "/en/help/" + helpKey;
    // }
    // }
    String path = "";
    handlerCtx.setOutputValue("url", path);
}
Also used : ConsolePluginService(org.glassfish.admingui.plugin.ConsolePluginService) Handler(com.sun.jsftemplating.annotation.Handler) LayoutViewHandler(com.sun.jsftemplating.layout.LayoutViewHandler)

Aggregations

ConsolePluginService (org.glassfish.admingui.plugin.ConsolePluginService)6 Handler (com.sun.jsftemplating.annotation.Handler)5 LayoutViewHandler (com.sun.jsftemplating.layout.LayoutViewHandler)3 Locale (java.util.Locale)2 URL (java.net.URL)1 ServletContext (javax.servlet.ServletContext)1 IntegrationPoint (org.glassfish.admingui.connector.IntegrationPoint)1 ServiceLocator (org.glassfish.hk2.api.ServiceLocator)1