當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。