Java Code Examples for com.google.gwt.core.ext.TreeLogger#branch()
The following examples show how to use
com.google.gwt.core.ext.TreeLogger#branch() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClientEngineLinker.java From flow with Apache License 2.0 | 6 votes |
@Override protected Collection<Artifact<?>> doEmitCompilation(TreeLogger logger, LinkerContext context, CompilationResult result, ArtifactSet artifacts) throws UnableToCompleteException { String[] js = result.getJavaScript(); if (js.length != 1) { logger.branch(TreeLogger.ERROR, "The module must not have multiple fragments when using the " + getDescription() + " Linker.", null); throw new UnableToCompleteException(); } ArrayList<Artifact<?>> toReturn = new ArrayList<>(); toReturn.add(new Script(result.getStrongName(), js[0])); toReturn.addAll( emitSelectionInformation(result.getStrongName(), result)); return toReturn; }
Example 2
Source File: ServiceBinderCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 6 votes |
private void writeCommandDefinition(TreeLogger logger, SourceWriter srcWriter, JMethod method, JParameter callbackParameter) throws UnableToCompleteException { srcWriter.print("CommandDefinition commandDefinition = new CommandDefinition("); srcWriter.print("\"%s\", ", this.serviceType.getQualifiedSourceName()); srcWriter.print("\"%s\", ", method.getName()); if (callbackParameter != null) { JParameterizedType parameterizedCallback = callbackParameter.getType().isParameterized(); if (parameterizedCallback != null) { srcWriter.print("\"%s\" ", parameterizedCallback.getTypeArgs()[0].getQualifiedSourceName()); } else { logger.branch(TreeLogger.ERROR, "Callback argument type for method " + method.getName() + " is not parametrized", null); throw new UnableToCompleteException(); } } else { srcWriter.print("\"%s\" ", method.getReturnType().getQualifiedSourceName()); } for (JParameter parameter : method.getParameters()) { if (!parameter.equals(callbackParameter)) { srcWriter.print(", \"%s\"", parameter.getType().getQualifiedSourceName()); } } srcWriter.println(");"); }
Example 3
Source File: WorkerLinker.java From ThinkMap with Apache License 2.0 | 6 votes |
@Override protected EmittedArtifact emitSelectionScript(TreeLogger logger, LinkerContext context, ArtifactSet artifacts) throws UnableToCompleteException { Set<WorkerScript> scripts = artifacts.find(WorkerScript.class); if (scripts.size() != 1) { logger.branch(TreeLogger.ERROR, "Too many scripts"); throw new UnableToCompleteException(); } WorkerScript script = scripts.iterator().next(); DefaultTextOutput output = new DefaultTextOutput(true); output.print(context.optimizeJavaScript(logger, generateSelectionScript(logger, context, artifacts))); output.newlineOpt(); output.print(script.javascript); output.newlineOpt(); output.print("gwtOnLoad(null, \"__MODULE_NAME__\", null);"); return emitString(logger, output.toString(), context.getModuleName() + ".worker.js"); }
Example 4
Source File: GadgetLinker.java From shortyz with GNU General Public License v3.0 | 5 votes |
@Override protected EmittedArtifact emitSelectionScript(TreeLogger logger, LinkerContext context, ArtifactSet artifacts) throws UnableToCompleteException { logger = logger.branch(TreeLogger.DEBUG, "Building gadget manifest", null); String bootstrap = "<script>" + context.optimizeJavaScript(logger, generateSelectionScript(logger, context, artifacts)) + "</script>\n" + "<div id=\"__gwt_gadget_content_div\"></div>"; // Read the content StringBuffer manifest = new StringBuffer(); try { BufferedReader in = new BufferedReader(new InputStreamReader( manifestArtifact.getContents(logger))); for (String line = in.readLine(); line != null; line = in.readLine()) { manifest.append(line).append("\n"); } in.close(); } catch (IOException e) { logger.log(TreeLogger.ERROR, "Unable to read manifest stub", e); throw new UnableToCompleteException(); } replaceAll(manifest, "__BOOTSTRAP__", bootstrap); return emitString(logger, manifest.toString(), manifestArtifact.getPartialPath()); }
Example 5
Source File: Mvp4gRunAsyncGenerator.java From mvp4g with Apache License 2.0 | 5 votes |
@Override public RebindResult generateIncrementally(TreeLogger logger, GeneratorContext generatorContext, String typeName) throws UnableToCompleteException { TypeOracle typeOracle = generatorContext.getTypeOracle(); assert (typeOracle != null); JClassType originalType = typeOracle.findType(typeName); if (originalType == null) { logger.log(TreeLogger.ERROR, "Unable to find metadata for type '" + typeName + "'"); throw new UnableToCompleteException(); } if (originalType.isInterface() == null) { logger.log(TreeLogger.ERROR, "'" + typeName + "' is not a interface"); throw new UnableToCompleteException(); } TreeLogger moduleLogger = logger.branch(TreeLogger.DEBUG, "Generating client proxy for remote service interface '" + originalType.getQualifiedSourceName() + "'", null); return create(originalType, moduleLogger, generatorContext, typeName); }
Example 6
Source File: Mvp4gGenerator.java From mvp4g with Apache License 2.0 | 5 votes |
@Override public RebindResult generateIncrementally(TreeLogger logger, GeneratorContext generatorContext, String moduleClass) throws UnableToCompleteException { TypeOracle typeOracle = generatorContext.getTypeOracle(); assert (typeOracle != null); JClassType module = typeOracle.findType(moduleClass); if (module == null) { logger.log(TreeLogger.ERROR, "Unable to find metadata for module class '" + moduleClass + "'"); throw new UnableToCompleteException(); } if (module.isInterface() == null) { logger.log(TreeLogger.ERROR, "'" + moduleClass + "' is not a interface"); throw new UnableToCompleteException(); } TreeLogger moduleLogger = logger.branch(TreeLogger.DEBUG, "Generating mvp4g configuration for module class '" + module.getQualifiedSourceName() + "'", null); return create(moduleLogger, generatorContext, moduleClass); }
Example 7
Source File: WorkerLinker.java From ThinkMap with Apache License 2.0 | 5 votes |
@Override protected Collection<Artifact<?>> doEmitCompilation(TreeLogger logger, LinkerContext context, CompilationResult result, ArtifactSet artifacts) throws UnableToCompleteException { String[] javascript = result.getJavaScript(); if (javascript.length != 1) { logger.branch(TreeLogger.ERROR, "Too many fragments"); throw new UnableToCompleteException(); } ArrayList<Artifact<?>> newArtifacts = new ArrayList<>(); newArtifacts.addAll(emitSelectionInformation(result.getStrongName(), result)); newArtifacts.add(new WorkerScript(result.getStrongName(), javascript[0])); return newArtifacts; }
Example 8
Source File: ModelCreator.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 4 votes |
private void generateStaticInitializer(TreeLogger logger, SourceWriter srcWriter) { srcWriter.println("protected static final Map<String, PropertyDescription> PROPERTIES = Maps.newHashMap();"); srcWriter.println("static{"); srcWriter.indent(); for (String propertyName : this.propertyTypes.keySet()) { JType propertyType = this.propertyTypes.get(propertyName); String simplePropertyTypeName = propertyType.getSimpleSourceName(); String modelName = this.subModels.get(propertyType); if (modelName != null) { modelName += ".INSTANCE"; } try { if (propertyType.isPrimitive() == null) { Class<?> propertyClass = Class.forName(propertyType.getQualifiedSourceName()); if (Collection.class.isAssignableFrom(propertyClass)) { JParameterizedType parametrizedType = propertyType.isParameterized(); JType subType = propertyType; if (parametrizedType != null) { subType = parametrizedType.getTypeArgs()[0]; String submodelName = this.subModels.get(subType); if (submodelName != null) { submodelName += ".INSTANCE"; } else { submodelName = subType.getSimpleSourceName() + ".class"; } modelName = String.format("new ModelCollection<%s>(%s.class, %s)", subType.getSimpleSourceName(), propertyType.getSimpleSourceName(), submodelName); } else { logger.branch(Type.WARN, String.format( "Property [%s] on bean %s is a raw collection type. You cannot use it on editors.", propertyName, this.beanType.getQualifiedSourceName())); modelName = "new ModelCollection((Model) null)"; } } } } catch (ClassNotFoundException e) { logger.branch(Type.WARN, String.format( "%s class not found.", propertyType.getQualifiedSourceName())); } Boolean getter = this.getters.containsKey(propertyName); Boolean setter = this.setters.containsKey(propertyName); srcWriter.print("PROPERTIES.put(\"%s\", newPropertyDescription(\"%s\", %s.class, %s, %s, %s", propertyName, propertyName, simplePropertyTypeName, modelName, getter, setter); this.generateValidators(srcWriter, propertyName); srcWriter.println("));"); } srcWriter.outdent(); srcWriter.println("}"); srcWriter.println("protected Map<String, PropertyDescription> getProperties(){"); srcWriter.println(" return PROPERTIES;"); srcWriter.println("}"); }