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


Java TreeLogger.log方法代码示例

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


在下文中一共展示了TreeLogger.log方法的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: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: getTestCases

import com.google.gwt.core.ext.TreeLogger; //导入方法依赖的package包/类
public static List<TestCase> getTestCases(TreeLogger logger, GeneratorContext context)
        throws UnableToCompleteException {
    if (DEBUG) logger = logger.branch(TreeLogger.WARN, "Getting test cases", null, null);
    TypeOracle oracle = context.getTypeOracle();
    JClassType jsTestCaseClass = oracle.findType(JsTestCase.class.getName());

    List<TestCase> testCases = new ArrayList<TestCase>();

    for (JClassType classType : oracle.getTypes()) {
        if (classType.equals(jsTestCaseClass) || !classType.isAssignableTo(jsTestCaseClass)) {
            continue;
        }

        if (classType.getEnclosingType() != null) {
            if (DEBUG) logger.log(TreeLogger.WARN, "Skipping nested class: " +
                    classType.getEnclosingType().getName() + "." + classType.getName());
            continue;
        }

        if (DEBUG) logger.log(TreeLogger.WARN, "Found class: " + classType.getName());
        testCases.add(new TestCase(classType, findTests(logger, context, classType)));
    }
    return testCases;
}
 
开发者ID:chromium,项目名称:dom-distiller,代码行数:25,代码来源:JsTestEntryGenerator.java

示例10: 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

示例11: GinjectorFragmentOutputter

import com.google.gwt.core.ext.TreeLogger; //导入方法依赖的package包/类
@Inject
GinjectorFragmentOutputter(GeneratorContext ctx, GinjectorFragmentContext.Factory ginjectorFragmentContextFactory, ErrorManager errorManager,
                           TreeLogger logger, SourceWriteUtil.Factory sourceWriteUtilFactory, @Assisted GinjectorBindings bindings,
                           @Assisted FragmentPackageName fragmentPackageName, @Assisted("ginjectorPackageName") String ginjectorPackageName,
                           @Assisted("ginjectorClassName") String ginjectorClassName) {

    this.ctx = ctx;
    this.errorManager = errorManager;
    this.logger = logger;
    this.sourceWriteUtil = sourceWriteUtilFactory.create(bindings);

    this.fragmentPackageName = fragmentPackageName;
    this.ginjectorClassName = ginjectorClassName;
    this.nameGenerator = bindings.getNameGenerator();

    fragmentClassName = nameGenerator.getFragmentClassName(ginjectorClassName, fragmentPackageName);
    if (fragmentClassName.contains(".")) {
        errorManager.logError("Internal error: the fragment class name \"%s\" contains a full stop.", fragmentClassName);
    }

    PrintWriter printWriter = ctx.tryCreate(logger, fragmentPackageName.toString(), fragmentClassName);
    if (printWriter == null) {
        // Something is very wrong! We already created this fragment, but the
        // GinjectorBindingsOutputter should only create each fragment once.
        // Something bad will probably happen later on if we continue, so just
        // abort.
        logger.log(TreeLogger.Type.ERROR, "The fragment " + fragmentPackageName + "." + fragmentClassName + " already exists.");
        throw new IllegalStateException("The fragment " + fragmentClassName + " already exists.");
    }

    ClassSourceFileComposerFactory composerFactory = new ClassSourceFileComposerFactory(fragmentPackageName.toString(), fragmentClassName);

    composerFactory.addImport(GWT.class.getCanonicalName());
    composerFactory.addImport(ginjectorPackageName + "." + ginjectorClassName);
    writer = composerFactory.createSourceWriter(ctx, printWriter);

    injectorWriteContext = ginjectorFragmentContextFactory.create(bindings, fragmentPackageName, writer);
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:39,代码来源:GinjectorFragmentOutputter.java

示例12: composeBindMethod

import com.google.gwt.core.ext.TreeLogger; //导入方法依赖的package包/类
/**
 * Generate method bind
 */
private void composeBindMethod(TreeLogger logger, SourceWriter sourceWriter) {

	logger.log(TreeLogger.INFO, "");
	String line = "public void bind("
			+ parameterizedType1.getQualifiedSourceName() + " text, "
			+ parameterizedType2.getQualifiedSourceName() + " obj){";
	sourceWriter.println(line);
	logger.log(TreeLogger.INFO, line);

	line = "  System.out.println(\"Implement it now:)\");";
	sourceWriter.println(line);
	logger.log(TreeLogger.INFO, line);

	ArrayList<JField> fields = new ArrayList<JField>();

	JClassType curtype = parameterizedType2;
	do {

		for (JField filed : curtype.getFields()) {
			fields.add(filed);
		}
		curtype = curtype.getSuperclass();
	} while (!curtype.getName().equals("Object"));

	for (JField field : fields) {
		String name = field.getName();
		String Name = name.substring(0, 1).toUpperCase() + name.substring(1);
		line = " text.setText(\"" + name + "\", obj.get" + Name
				+ "().toString() );";
		sourceWriter.println(line);
		logger.log(TreeLogger.INFO, line);

	}
	line = "}";

	sourceWriter.println(line);
	logger.log(TreeLogger.INFO, line);

}
 
开发者ID:ICT-BDA,项目名称:EasyML,代码行数:43,代码来源:TextBinderGenerator.java

示例13: generate

import com.google.gwt.core.ext.TreeLogger; //导入方法依赖的package包/类
@Override
public String generate(TreeLogger logger, GeneratorContext generatorContext, String typeName)
throws UnableToCompleteException
{
    TypeOracle types = generatorContext.getTypeOracle();

    ClassName componentTypeName = ClassName.bestGuess(typeName.substring(0,
        typeName.length() - COMPONENT_TEMPLATE_SUFFIX.length()));

    JClassType componentJsType;
    try
    {
        componentJsType =
            types.getType(componentJsTypeName(componentTypeName).reflectionName());
    }
    catch (NotFoundException nfe)
    {
        logger.log(Type.ERROR, "Not Found", nfe);
        throw new UnableToCompleteException();
    }

    ClassName templateImplTypeName = componentTemplateImplName(componentTypeName);
    PrintWriter printWriter = generatorContext.tryCreate(logger,
        templateImplTypeName.packageName(),
        templateImplTypeName.simpleName());

    if (printWriter != null)
    {
        generateOnce(printWriter, logger, generatorContext, componentJsType, componentTypeName);
    }

    return templateImplTypeName.reflectionName();
}
 
开发者ID:Axellience,项目名称:vue-gwt,代码行数:34,代码来源:TemplateGwtGenerator.java

示例14: createTemplateImpl

import com.google.gwt.core.ext.TreeLogger; //导入方法依赖的package包/类
/**
 * Create the template resource implementation based on the result of the template parser.
 * @param context The resource context (used to retrieve resources)
 * @param printWriter The source writer
 * @param componentTypeName The name of our Template class
 * @param templateParserResult The result of the HTML template parsed by {@link TemplateParser}
 * @throws UnableToCompleteException in case it fails to compile the HTML template to a JS
 * render function
 */
private void createTemplateImpl(GeneratorContext context, TreeLogger logger,
    PrintWriter printWriter, ClassName componentTypeName,
    TemplateParserResult templateParserResult) throws UnableToCompleteException
{
    // Resources are in the "client" folder to be included during GWT compilation
    Folder folder = new GwtResourceFolder(context.getResourcesOracle(),
        "com/axellience/vuegwt/gwt2/client/template/compiler");

    TemplateImplBuilder templateImplBuilder = new TemplateImplBuilder();
    TypeSpec templateImplType =
        templateImplBuilder.buildTemplateImpl(componentTypeName, templateParserResult, folder);

    // Write class
    JavaFile javaFile =
        JavaFile.builder(componentTypeName.packageName(), templateImplType).build();

    try
    {
        javaFile.writeTo(printWriter);
    }
    catch (IOException e)
    {
        logger.log(TreeLogger.ERROR,
            "Cannot write java file for component: " + componentTypeName.reflectionName());
        throw new UnableToCompleteException();
    }

    context.commit(logger, printWriter);
}
 
开发者ID:Axellience,项目名称:vue-gwt,代码行数:39,代码来源:TemplateGwtGenerator.java

示例15: appendClassBody

import com.google.gwt.core.ext.TreeLogger; //导入方法依赖的package包/类
private static void appendClassBody(final SourceWriter sourceWriter, final Set<JType> reflectedClasses,
        final TreeLogger logger) {
    sourceWriter.println("private static final Class<?>[] POOL = new Class<?>[] { ");
    logger.log(Type.INFO, "UEDI: Found the following UEDI components:");
    for (final JType reflectedClass : reflectedClasses) {
        logger.log(Type.INFO, reflectedClass.getQualifiedSourceName());
        sourceWriter.print(reflectedClass.getQualifiedSourceName() + ".class, ");
    }
    sourceWriter.println(" };");
    sourceWriter.println("@Override public Class<?>[] getReflectedClasses() { return POOL; } ");
}
 
开发者ID:czyzby,项目名称:uedi,代码行数:12,代码来源:ReflectionPoolGenerator.java


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