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


Java UnableToCompleteException类代码示例

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


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

示例1: getTemplateContent

import com.google.gwt.core.ext.UnableToCompleteException; //导入依赖的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.UnableToCompleteException; //导入依赖的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.UnableToCompleteException; //导入依赖的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.UnableToCompleteException; //导入依赖的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.UnableToCompleteException; //导入依赖的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.UnableToCompleteException; //导入依赖的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.UnableToCompleteException; //导入依赖的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.UnableToCompleteException; //导入依赖的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.UnableToCompleteException; //导入依赖的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: getWarDirectory

import com.google.gwt.core.ext.UnableToCompleteException; //导入依赖的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:playn,项目名称:playn,代码行数:23,代码来源:AutoClientBundleGenerator.java

示例11: getMethodNames

import com.google.gwt.core.ext.UnableToCompleteException; //导入依赖的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

示例12: createSource

import com.google.gwt.core.ext.UnableToCompleteException; //导入依赖的package包/类
@Override
protected void createSource(SourceWriter source, JClassType classType) {
	source.println("public " + getSimpleUnitName(classType) + "(){");
	source.indent();
	
	List<JClassType> types = allReflectionClasses();
	
	for(JClassType type : types){
		ReflectionProxyGenerator gen = new ReflectionProxyGenerator();
		try {
			String classname = gen.generate(this.logger, context, type.getQualifiedSourceName());
			source.println("new " + classname + "();");
		} catch (UnableToCompleteException e) {
			throw new CheckedExceptionWrapper(e);
		}
	}
	
	source.outdent();
	source.println("}");
}
 
开发者ID:liraz,项目名称:gwt-backbone,代码行数:21,代码来源:SourceVisitor.java

示例13: getPropertyModuleClasses

import com.google.gwt.core.ext.UnableToCompleteException; //导入依赖的package包/类
@SuppressWarnings("unchecked") // We check that the class is a GinModule before casting it.
private void getPropertyModuleClasses(Class<?> ginjectorType,
    Set<Class<? extends GinModule>> ginModules) throws UnableToCompleteException {
  Set<String> propertyModuleNames = getPropertyModuleNames(ginjectorType);
  for (String moduleName : propertyModuleNames) {
    try {

      // Gin modules must be initialized when loading since we will instantiate it. It is
      // officially illegal to call any GWT-client code in a Gin module.
      Class<?> ginModule = loadClass(moduleName, true);
      if (!GinModule.class.isAssignableFrom(ginModule)) {
        logger.log(TreeLogger.Type.ERROR, String.format("The gin module type [%s] does not "
            + "inherit from GinModule.", moduleName));
        throw new UnableToCompleteException();
      }
      ginModules.add((Class<? extends GinModule>) ginModule);
    } catch (ClassNotFoundException e) {
      logger.log(TreeLogger.ERROR, String.format("Unable to load gin module type [%s], "
          + "maybe you haven't compiled your client java sources?", moduleName), e);
      throw new UnableToCompleteException();
    }
  }
}
 
开发者ID:google-code-export,项目名称:google-gin,代码行数:24,代码来源:GinjectorGenerator.java

示例14: getPropertyModuleNames

import com.google.gwt.core.ext.UnableToCompleteException; //导入依赖的package包/类
private Set<String> getPropertyModuleNames(Class<?> ginjectorType)
    throws UnableToCompleteException {
  Set<String> propertyNames = new LinkedHashSet<String>();
  getPropertyNamesFromInjectorInterface(ginjectorType, propertyNames);

  Set<String> configurationModuleNames = new LinkedHashSet<String>();
  for (String propertyName : propertyNames) {
    Set<String> moduleNames = getValuesForProperty(propertyName);
    if (moduleNames.isEmpty()) {
      logger.log(TreeLogger.Type.ERROR, String.format("The GinModules annotation requests "
          + "property %s, but this property cannot be found in the GWT module.", propertyName));
      throw new UnableToCompleteException();
    }
    configurationModuleNames.addAll(moduleNames);
  }
  return configurationModuleNames;
}
 
开发者ID:google-code-export,项目名称:google-gin,代码行数:18,代码来源:GinjectorGenerator.java

示例15: generate

import com.google.gwt.core.ext.UnableToCompleteException; //导入依赖的package包/类
public String generate() throws UnableToCompleteException {
  validateInjectorClass();

  Package interfacePackage = ginjectorInterface.getRawType().getPackage();
  String packageName = interfacePackage == null ? "" : interfacePackage.getName();
  String implClassName = getImplClassName();
  String generatedClassName = packageName + "." + implClassName;

  PrintWriter printWriter = ctx.tryCreate(logger, packageName, implClassName);
  if (printWriter == null) {
    // We've already created it, so nothing to do
  } else {
    bindingsProcessor.process();
    outputter.write(packageName, implClassName, printWriter, rootBindings);
  }

  return generatedClassName;
}
 
开发者ID:google-code-export,项目名称:google-gin,代码行数:19,代码来源:GinjectorGeneratorImpl.java


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