当前位置: 首页>>代码示例>>Java>>正文


Java TreeLogger类代码示例

本文整理汇总了Java中com.google.gwt.core.ext.TreeLogger的典型用法代码示例。如果您正苦于以下问题:Java TreeLogger类的具体用法?Java TreeLogger怎么用?Java TreeLogger使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TreeLogger类属于com.google.gwt.core.ext包,在下文中一共展示了TreeLogger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTemplateContent

import com.google.gwt.core.ext.TreeLogger; //导入依赖的package包/类
private String getTemplateContent(ResourceOracle resourceOracle, TreeLogger logger,
    ClassName componentTypeName) throws UnableToCompleteException
{
    String path = slashify(componentTypeName.reflectionName()) + TEMPLATE_EXTENSION;
    Resource resource = resourceOracle.getResource(path);

    // No resource for the template
    if (resource == null)
    {
        logger.log(TreeLogger.ERROR,
            "\nCouldn't find template for component \""
                + componentTypeName.reflectionName()
                + "\". If it doesn't have a template please set hasTemplate to false in the @Component annotation.");
        throw new UnableToCompleteException();
    }

    // Get template content from HTML file
    try
    {
        return Util.readStreamAsString(resource.openContents());
    }
    catch (IOException e)
    {
        logger.log(TreeLogger.ERROR,
            "\nFailed to open template file for component \""
                + componentTypeName.reflectionName());
        throw new UnableToCompleteException();
    }
}
 
开发者ID:Axellience,项目名称:vue-gwt,代码行数:30,代码来源:TemplateGwtGenerator.java

示例2: generateOnce

import com.google.gwt.core.ext.TreeLogger; //导入依赖的package包/类
private void generateOnce(PrintWriter printWriter, TreeLogger logger,
    GeneratorContext generatorContext, JClassType componentJsType, ClassName componentTypeName)
throws UnableToCompleteException
{
    String templateContent =
        getTemplateContent(generatorContext.getResourcesOracle(), logger, componentTypeName);

    LocalComponents localComponents = new LocalComponents();
    findLocalComponentsForComponent(localComponents,
        componentJsType.getSuperclass(),
        generatorContext.getTypeOracle());

    TemplateParserContext templateParserContext =
        new TemplateParserContext(componentTypeName, localComponents);
    registerFieldsAndMethodsInContext(templateParserContext, componentJsType);

    TemplateParserResult templateParserResult =
        new TemplateParser(logger).parseHtmlTemplate(templateContent, templateParserContext);

    createTemplateImpl(generatorContext,
        logger,
        printWriter,
        componentTypeName,
        templateParserResult);
}
 
开发者ID:Axellience,项目名称:vue-gwt,代码行数:26,代码来源:TemplateGwtGenerator.java

示例3: generate

import com.google.gwt.core.ext.TreeLogger; //导入依赖的package包/类
@Override public String generate(TreeLogger logger, GeneratorContext context, String typeName) throws UnableToCompleteException {	
String result = null;
try {
	String version = findVersion(logger, context);
	JClassType classType = context.getTypeOracle().getType(typeName);
	String packageName = packageNameFrom(classType);
	String simpleName = simpleNameFrom(classType);
	result = packageName + '.' + simpleName;
	SourceWriter source = getSourceWriter(logger, context, classType); 
	if(source != null) { //? Otherwise, work needs to be done.
	    source.println();
	    source.println("private String value;");
	    source.println();
	    source.println("public " + simpleName + "() {");
	    populateInstanceFactory(logger, context, typeName, source, version);
	    source.println("}");
	    source.println();
	    source.println("@Override");
	    source.println("public String getValue() {");
	    source.println(" return value;");
	    source.println("}");
	    source.println(); source.commit(logger);
	    //emitVersionArtifact(logger, context, version);
    }
} catch (NotFoundException nfe) {
    logger.log(Type.ERROR, "Could not find extension point type '" + typeName + "'!", nfe);
    throw new UnableToCompleteException();
} 
return result;
  }
 
开发者ID:TOMOTON,项目名称:gwt-dagger2,代码行数:31,代码来源:VersionGenerator.java

示例4: findVersion

import com.google.gwt.core.ext.TreeLogger; //导入依赖的package包/类
@SuppressWarnings("resource")
private String findVersion(TreeLogger logger, GeneratorContext context) throws UnableToCompleteException {
   	String result = "0.0.0-DEV";
   	Scanner scanner = null;
   	try {
		URL location = Version.class.getClassLoader().getResource("VERSION");
		scanner = new Scanner(location.openStream(), "UTF-8").useDelimiter("\\A");
		result = scanner.next();
	} catch (IOException ioe) {
	    logger.log(Type.ERROR, "Could not determine build version!", ioe);
	    throw new UnableToCompleteException();
	} finally {
		try { scanner.close(); } catch (Exception ignore) {}
	}
   	return result;
   }
 
开发者ID:TOMOTON,项目名称:gwt-dagger2,代码行数:17,代码来源:VersionGenerator.java

示例5: findReflectedClasses

import com.google.gwt.core.ext.TreeLogger; //导入依赖的package包/类
protected Set<JType> findReflectedClasses(final GeneratorContext context, final TypeOracle typeOracle,
        final TreeLogger logger) throws UnableToCompleteException {
    final Set<JType> types = new HashSet<JType>();
    final Set<String> uediInterfaceNames = getUediInterfaceNames();
    final Set<JClassType> uediInterfaces = new HashSet<JClassType>();
    final String rootPackage = getRootPackage(context, logger);

    for (final JPackage jPackage : typeOracle.getPackages()) {
        for (final JClassType jType : jPackage.getTypes()) {
            if (uediInterfaceNames.contains(jType.getQualifiedSourceName())) {
                uediInterfaces.add(jType);
            } else if (jType.isClass() != null && jType.isInterface() == null && !jType.isClass().isAbstract()
                    && jType.getQualifiedSourceName().startsWith(rootPackage)) {
                types.add(jType);
            }
        }
    }
    if (uediInterfaces.size() < uediInterfaceNames.size()) {
        logger.log(Type.ERROR, "UEDIT: Unable to find UEDI interfaces in classpath. Aborting.");
        throw new UnableToCompleteException();
    }
    return filter(types, uediInterfaces);
}
 
开发者ID:czyzby,项目名称:uedi,代码行数:24,代码来源:ReflectionPoolGenerator.java

示例6: link

import com.google.gwt.core.ext.TreeLogger; //导入依赖的package包/类
@Override
public ArtifactSet link(TreeLogger logger, LinkerContext context, ArtifactSet artifacts) throws UnableToCompleteException {
    ArtifactSet toReturn = new ArtifactSet(artifacts);

    Set<EmittedArtifact> emittedArtifacts = artifacts.find(EmittedArtifact.class);
    for (EmittedArtifact emittedArtifact : emittedArtifacts) {
        String partialPath = emittedArtifact.getPartialPath();
        // Add to Cesium.js file, path, where Cesium/Cesium.js stored.
        // It need for inject css files for example - Viewer
        if (partialPath.endsWith("/Cesium.js")) {
            String contents = CesiumLinkerUtils.getContents(emittedArtifact, logger);
            StringBuffer sb = new StringBuffer(contents);
            sb.insert(0, "window.CesiumPath = '" + context.getModuleName() + "/js/';\n");
            toReturn.remove(emittedArtifact);
            toReturn.add(emitString(logger, sb.toString(), partialPath));
        }
    }
    return toReturn;
}
 
开发者ID:iSergio,项目名称:gwt-cs,代码行数:20,代码来源:CesiumLinker.java

示例7: getContents

import com.google.gwt.core.ext.TreeLogger; //导入依赖的package包/类
static String getContents(EmittedArtifact emittedArtifact, TreeLogger logger) throws UnableToCompleteException {
    InputStream in = emittedArtifact.getContents(logger);
    BufferedInputStream bis = new BufferedInputStream(in);
    ByteArrayOutputStream buf = new ByteArrayOutputStream();
    try {
        // Fix for SmartGWT. Thanks for Mark Erikson (https://groups.google.com/forum/#!msg/cesium-dev/ZfyW0CNRsSU/lP6KTaUpEQAJ)
        buf.write("if (window.buildInDataView === undefined) {window.buildInDataView = window.DataView;}\n".getBytes());
        int result = bis.read();
        while (result != -1) {
            byte b = (byte) result;
            buf.write(b);
            result = bis.read();

        }
    } catch (IOException e) {
        logger.log(TreeLogger.ERROR, "Unable to read resource", e);
        throw new UnableToCompleteException();
    }
    return buf.toString();
}
 
开发者ID:iSergio,项目名称:gwt-cs,代码行数:21,代码来源:CesiumLinkerUtils.java

示例8: link

import com.google.gwt.core.ext.TreeLogger; //导入依赖的package包/类
@Override
public ArtifactSet link(TreeLogger logger, LinkerContext context, ArtifactSet artifacts) throws UnableToCompleteException {
    ArtifactSet toReturn = new ArtifactSet(artifacts);

    Set<EmittedArtifact> emittedArtifacts = artifacts.find(EmittedArtifact.class);
    for (EmittedArtifact emittedArtifact : emittedArtifacts) {
        String partialPath = emittedArtifact.getPartialPath();
        // Add to Cesium.js file, path, where Cesium/Cesium.js stored.
        // It need for inject css files for example - Viewer
        if (partialPath.endsWith("/olcesium.js")) {
            String contents = OLCesiumLinkerUtils.getContents(emittedArtifact, logger);
            StringBuffer sb = new StringBuffer(contents);
            sb.insert(0, "window.OpenLayersPath = '" + context.getModuleName() + "/js/';\n");
            toReturn.remove(emittedArtifact);
            toReturn.add(emitString(logger, sb.toString(), partialPath));
        }
    }
    return toReturn;
}
 
开发者ID:iSergio,项目名称:gwt-olcs,代码行数:20,代码来源:OLCesiumLinker.java

示例9: getContents

import com.google.gwt.core.ext.TreeLogger; //导入依赖的package包/类
static String getContents(EmittedArtifact emittedArtifact, TreeLogger logger) throws UnableToCompleteException {
    InputStream in = emittedArtifact.getContents(logger);
    BufferedInputStream bis = new BufferedInputStream(in);
    ByteArrayOutputStream buf = new ByteArrayOutputStream();
    try {
        int result = bis.read();
        while (result != -1) {
            byte b = (byte) result;
            buf.write(b);
            result = bis.read();

        }
    } catch (IOException e) {
        logger.log(TreeLogger.ERROR, "Unable to read resource", e);
        throw new UnableToCompleteException();
    }
    return buf.toString();
}
 
开发者ID:iSergio,项目名称:gwt-olcs,代码行数:19,代码来源:OLCesiumLinkerUtils.java

示例10: getMethodNames

import com.google.gwt.core.ext.TreeLogger; //导入依赖的package包/类
private Set<String> getMethodNames(String className, TreeLogger logger,
                             TypeOracle typeOracle) throws UnableToCompleteException {
  
  JClassType baseClass = typeOracle.findType(className);
  if (baseClass == null) {
    logger.log(TreeLogger.ERROR, "Unable to find metadata for type '" + baseClass + "'", null);
    throw new UnableToCompleteException();
  }
  
  Set<String> result = new HashSet<String>();
  for (JMethod method : baseClass.getMethods()) {
    if (!method.isPrivate()) {
      result.add(method.getName());
    }
  }
  
  return result;
}
 
开发者ID:google,项目名称:easy-gwt-mock,代码行数:19,代码来源:MocksControlGenerator.java

示例11: findTests

import com.google.gwt.core.ext.TreeLogger; //导入依赖的package包/类
public static List<JMethod> findTests(
        TreeLogger logger, GeneratorContext context, JClassType classType)
        throws UnableToCompleteException {
    if (DEBUG) logger = logger.branch(TreeLogger.WARN,
            "Finding tests for class: " + classType.getName());

    List<JMethod> tests = new ArrayList<JMethod>();
    for (JMethod method : classType.getMethods()) {
        if (method.getName().startsWith("test")) {
            if (DEBUG) logger.log(TreeLogger.WARN, "Found test: " + method.getName());
            verifyTestSignature(logger, classType, method);
            tests.add(method);
        }
    }
    return tests;
}
 
开发者ID:chromium,项目名称:dom-distiller,代码行数:17,代码来源:JsTestEntryGenerator.java

示例12: name

import com.google.gwt.core.ext.TreeLogger; //导入依赖的package包/类
private String name(TreeLogger logger, PublicResource r) throws UnableToCompleteException {
  byte[] out;
  try (ByteArrayOutputStream tmp = new ByteArrayOutputStream();
      InputStream in = r.getContents(logger)) {
    final byte[] buf = new byte[2048];
    int n;
    while ((n = in.read(buf)) >= 0) {
      tmp.write(buf, 0, n);
    }
    out = tmp.toByteArray();
  } catch (IOException e) {
    final UnableToCompleteException ute = new UnableToCompleteException();
    ute.initCause(e);
    throw ute;
  }

  String base = r.getPartialPath();
  final int s = base.lastIndexOf('/');
  if (0 < s) {
    base = base.substring(0, s + 1);
  } else {
    base = "";
  }
  return base + Util.computeStrongName(out) + ".cache.css";
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:26,代码来源:CssLinker.java

示例13: addAnnotations_AnnotationImpl

import com.google.gwt.core.ext.TreeLogger; //导入依赖的package包/类
public static void addAnnotations_AnnotationImpl(TypeOracle typeOracle,
    String dest, SourceWriter source, Annotation[] annotations, TreeLogger logger){

  if (annotations.length <= 0)
	  return;
	
  for (Annotation annotation : annotations) {
  	JClassType classType = typeOracle.findType(ReflectionUtils.getQualifiedSourceName(annotation.annotationType()));
  	if (classType != null){
  		source.print(dest + ".addAnnotation(" + createAnnotationValues(typeOracle, annotation, logger) + ");");
			
  	}else{
  		logger.log(Type.ERROR, "Annotation (" + ReflectionUtils.getQualifiedSourceName(annotation.annotationType()) + ") not exists in compiled client source code, please ensure this class is exists and included in your module(.gwt.xml) file. GWTENT reflection process will ignore it and continue. ");
  	}
   }
}
 
开发者ID:liraz,项目名称:gwt-backbone,代码行数:17,代码来源:GeneratorHelper.java

示例14: setUp

import com.google.gwt.core.ext.TreeLogger; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected void setUp() throws Exception {
  control = createControl();
  positions = control.createMock(BindingPositioner.class);
  graph = control.createMock(DependencyGraph.class);
  output = control.createMock(DependencyExplorerOutput.class);
  treeLogger = createNiceMock(TreeLogger.class);
  positionsFactory = control.createMock("positionsFactory", BindingPositioner.Factory.class);
  
  root = control.createMock("root", GinjectorBindings.class);
  child = control.createMock("child", GinjectorBindings.class);
  
  bindingFactory = control.createMock(BindingFactory.class);

  expect(positionsFactory.create(treeLogger)).andStubReturn(positions);
  control.replay();
  installer = new BindingInstaller(positionsFactory, bindingFactory, treeLogger);
  control.verify();
  control.reset();

  expect(output.getGraph()).andStubReturn(graph);
  positions.position(output);
  expect(graph.getOrigin()).andStubReturn(child);
}
 
开发者ID:google-code-export,项目名称:google-gin,代码行数:26,代码来源:BindingInstallerTest.java

示例15: getWarDirectory

import com.google.gwt.core.ext.TreeLogger; //导入依赖的package包/类
/**
 * When invoking the GWT compiler from GPE, the working directory is the Eclipse project
 * directory. However, when launching a GPE project, the working directory is the project 'war'
 * directory. This methods returns the war directory in either case in a fairly naive and
 * non-robust manner.
 */
private File getWarDirectory(TreeLogger logger) throws UnableToCompleteException {
  File currentDirectory = new File(".");
  try {
    String canonicalPath = currentDirectory.getCanonicalPath();
    logger.log(TreeLogger.INFO, "Current directory in which this generator is executing: "
        + canonicalPath);
    if (canonicalPath.endsWith("war")) {
      return currentDirectory;
    } else {
      return new File("war");
    }
  } catch (IOException e) {
    logger.log(TreeLogger.ERROR, "Failed to get canonical path", e);
    throw new UnableToCompleteException();
  }
}
 
开发者ID:fredsa,项目名称:forplay,代码行数:23,代码来源:AutoClientBundleGenerator.java


注:本文中的com.google.gwt.core.ext.TreeLogger类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。