Package com.google.gwt.dev.resource

Examples of com.google.gwt.dev.resource.Resource


      if (cudRef != null) {
        cud = cudRef.get();
      }
    }
    if (cud == null) {
      Resource classSource = classSources.get(topType);
      String source = null;
      if (classSource != null) {
        try {
          InputStream stream = classSource.openContents();
          source = Util.readStreamAsString(stream);
        } catch (IOException ex) {
          throw new InternalCompilerException("Problem reading resource: "
              + classSource.getLocation(), ex);
        }
      }
      if (source == null) {
        // cache negative result so we don't try again
        cudCache.put(topType, null);
View Full Code Here


  }

  public void remove(String... paths) {
    Map<String, Resource> newMap = new HashMap<String, Resource>(exportedMap);
    for (String path : paths) {
      Resource oldValue = newMap.remove(path);
      if (oldValue == null) {
        throw new IllegalArgumentException(String.format(
            "Attempted to remove non-existing resource with path [%s]", path));
      }
    }
View Full Code Here

    }

    String sourceName = sourceType.getQualifiedSourceName();
    String sourcePath = sourceName.replace('.', '/') + ".java";

    Resource sourceResource = module.findSourceFile(sourcePath);

    if (sourceResource == null) {
      return 0L;
    }

    return sourceResource.getLastModified();
  }
View Full Code Here

    private Document getW3cDoc(MortalLogger logger, DesignTimeUtils designTime,
            ResourceOracle resourceOracle, String templatePath)
            throws UnableToCompleteException {

        Resource resource = resourceOracle.getResourceMap().get(templatePath);
        if (null == resource) {
            logger.die("Unable to find resource: " + templatePath);
        }

        Document doc = null;
        try {
            String content = designTime.getTemplateContent(templatePath);
            if (content == null) {
                content = Util.readStreamAsString(resource.openContents());
            }
            doc = new W3cDomHelper(logger.getTreeLogger(), resourceOracle).documentFor(
                    content, resource.getPath());
        } catch (IOException iex) {
            logger.die("Error opening resource:" + resource.getLocation(), iex);
        } catch (SAXParseException e) {
            logger.die(
                    "Error parsing XML (line " + e.getLineNumber() + "): "
                            + e.getMessage(), e);
        }
View Full Code Here

    String partialPath = localizedPath.replace('.', '/');
    for (int i = 0; i < loaders.size(); i++) {
      ResourceFactory element = loaders.get(i);
      String ext = "." + element.getExt();
      String path = partialPath + ext;
      Resource resource = resourceMap.get(path);
      if (resource == null && partialPath.contains("$")) {
        // Also look for A_B for inner classes, as $ in path names
        // can cause issues for some build tools.
        path = partialPath.replace('$', '_') + ext;
        resource = resourceMap.get(path);
      }
      if (resource != null) {
        AbstractResource found = element.load(resource.openContents(), locale);
        found.setPath(path);
        resources.add(found);
      }
    }
  }
View Full Code Here

    public ResourceOracleLocator(ResourceOracle oracle) {
      resourceMap = oracle.getResourceMap();
    }

    public URL locate(String resourceName) {
      Resource r = resourceMap.get(resourceName);
      return r == null ? null : r.getURL();
    }
View Full Code Here

      resourceMap = oracle.getResourceMap();
    }

    @SuppressWarnings("deprecation")
    public URL locate(String resourceName) {
      Resource r = resourceMap.get(resourceName);
      return (r == null) ? null : r.getURL();
    }
View Full Code Here

      resourceMap = oracle.getResourceMap();
    }

    @SuppressWarnings("deprecation")
    public URL locate(String resourceName) {
      Resource r = resourceMap.get(resourceName);
      return (r == null) ? null : r.getURL();
    }
View Full Code Here

  private Document getW3cDoc(MortalLogger logger, DesignTimeUtils designTime,
      ResourceOracle resourceOracle, String templatePath)
      throws UnableToCompleteException {

    Resource resource = resourceOracle.getResourceMap().get(templatePath);
    if (null == resource) {
      logger.die("Unable to find resource: " + templatePath);
    }

    Document doc = null;
    try {
      String content = designTime.getTemplateContent(templatePath);
      if (content == null) {
        content = Util.readStreamAsString(resource.openContents());
      }
      doc = new W3cDomHelper(logger.getTreeLogger(), resourceOracle).documentFor(
          content, resource.getPath());
    } catch (SAXParseException e) {
      logger.die(
          "Error parsing XML (line " + e.getLineNumber() + "): "
              + e.getMessage(), e);
    }
View Full Code Here

  }

  public void remove(String... paths) {
    Map<String, Resource> newMap = new HashMap<String, Resource>(exportedMap);
    for (String path : paths) {
      Resource oldValue = newMap.remove(path);
      if (oldValue == null) {
        throw new IllegalArgumentException(String.format(
            "Attempted to remove non-existing resource with path [%s]", path));
      }
    }
View Full Code Here

TOP

Related Classes of com.google.gwt.dev.resource.Resource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.