List of usage examples for com.google.gwt.dev.cfg ModuleDef getActivePrimaryLinker
public Class<? extends Linker> getActivePrimaryLinker()
From source file:com.smartgwt.linker.SmartGwtScriptInjector.java
License:Open Source License
private boolean forceScriptLoad(TreeLogger logger, String moduleName, Float gwtVersion) { try {//from w ww . ja v a 2s. c om ModuleDef module; Method getModuleDef; // ModuleDefLoader.loadFromClassPath has two possible signatures if (gwtVersion < 2.6f) { getModuleDef = MODULE_DEF_LOADER_CLASS.getDeclaredMethod("loadFromClassPath", new Class[] { TreeLogger.class, String.class }); module = (ModuleDef) getModuleDef.invoke(null, logger, moduleName); } else { Class compilerContextClass = Class.forName(COMPILER_CONTEXT); getModuleDef = MODULE_DEF_LOADER_CLASS.getDeclaredMethod("loadFromClassPath", new Class[] { TreeLogger.class, compilerContextClass, String.class }); module = (ModuleDef) getModuleDef.invoke(null, logger, null, moduleName); } // now use the module to check whether primary linker ist he CrossSiteIframeLinker if (module != null) return XSI_LINKER_CLASS.equals(module.getActivePrimaryLinker()); logger.log(TreeLogger.WARN, "Can't find module reference - not injecting scripts."); } catch (Throwable t) { logger.log(TreeLogger.ERROR, "Encountered an exception while trying to " + "resolve the ModuleDef for " + moduleName, t); } return false; }
From source file:org.cesiumjs.linker.CesiumScriptInjector.java
License:Apache License
private boolean forceScriptLoad(TreeLogger logger, String moduleName, Float gwtVersion) { try {/*from ww w .ja va 2s . co m*/ ModuleDef module; Method getModuleDef; if (gwtVersion < 2.6f) { getModuleDef = ModuleDefLoader.class.getDeclaredMethod("loadFromClassPath", new Class[] { TreeLogger.class, String.class }); module = (ModuleDef) getModuleDef.invoke(null, logger, moduleName); } else if (gwtVersion < 2.8f) { Class compilerContextClass = Class.forName("com.google.gwt.dev.CompilerContext"); Object context = compilerContextClass.getDeclaredConstructor().newInstance(); getModuleDef = ModuleDefLoader.class.getDeclaredMethod("loadFromClassPath", new Class[] { TreeLogger.class, compilerContextClass, String.class }); module = (ModuleDef) getModuleDef.invoke(null, logger, compilerContextClass.cast(context), moduleName); } else { getModuleDef = ModuleDefLoader.class.getDeclaredMethod("loadFromClassPath", new Class[] { TreeLogger.class, String.class, boolean.class }); module = (ModuleDef) getModuleDef.invoke(null, logger, moduleName, false); } if (module != null) return CrossSiteIframeLinker.class.equals(module.getActivePrimaryLinker()); logger.log(TreeLogger.WARN, "Can't find module reference - not injecting scripts."); } catch (Throwable t) { logger.log(TreeLogger.ERROR, "Encountered an exception while trying to resolve the ModuleDef for " + moduleName, t); } return false; }