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