/** * Post an error. Sets the {@link #hasErrors} flag */ public void error(String message, Object... params) { hasErrors = true; logger.getTreeLogger().log(TreeLogger.ERROR, String.format(message, params)); }
/** * Post an error. Sets the {@link #hasErrors} flag */ public void error(String message, Object... params) { hasErrors = true; logger.getTreeLogger().log(TreeLogger.ERROR, String.format(message, params)); }
private List<URL> getExternalCss() throws UnableToCompleteException { /* * TODO(rjrjr,bobv) refactor ResourceGeneratorUtil.findResources so we can * find them the same way ClientBundle does. For now, just look relative to * this package */ String path = packageName.replace(".", "/"); List<URL> urls = new ArrayList<URL>(); for (String s : sources) { String resourcePath = path + '/' + s; // Try to find the resource relative to the package. URL found = ResourceLocatorImpl.tryFindResourceUrl(logger.getTreeLogger(), resourceOracle, resourcePath); /* * If we didn't find the resource relative to the package, assume it * is absolute. */ if (found == null) { found = ResourceLocatorImpl.tryFindResourceUrl(logger.getTreeLogger(), resourceOracle, s); } if (found == null) { logger.die("Unable to find resource: " + resourcePath); } urls.add(found); } return urls; }
private List<URL> getExternalCss() throws UnableToCompleteException { /* * TODO(rjrjr,bobv) refactor ResourceGeneratorUtil.findResources so we can * find them the same way ClientBundle does. For now, just look relative to * this package */ String path = packageName.replace(".", "/"); List<URL> urls = new ArrayList<URL>(); for (String s : sources) { String resourcePath = path + '/' + s; // Try to find the resource relative to the package. URL found = ResourceLocatorImpl.tryFindResourceUrl(logger.getTreeLogger(), resourceOracle, resourcePath); /* * If we didn't find the resource relative to the package, assume it * is absolute. */ if (found == null) { found = ResourceLocatorImpl.tryFindResourceUrl(logger.getTreeLogger(), resourceOracle, s); } if (found == null) { logger.die("Unable to find resource: " + resourcePath); } urls.add(found); } return urls; }
/** * Returns the set of CSS classnames in the underlying css or gss files. * * @throws UnableToCompleteException if the user has called for a css/gss file we * can't find. */ public Set<String> getCssClassNames() throws UnableToCompleteException { List<URL> urls = getExternalCss(); if (cssClassNames == null) { final File bodyFile = getGeneratedFile(); if (bodyFile != null) { try { urls.add(bodyFile.toURI().toURL()); } catch (MalformedURLException e) { throw new RuntimeException(e); } } assert urls.size() > 0; if (gss) { return getCssClassNames(bodyFile.getName(), body, imports, logger.getTreeLogger()); } else { CssStylesheet sheet = GenerateCssAst.exec(logger.getTreeLogger(), urls.toArray(new URL[urls.size()])); cssClassNames = ExtractClassNamesVisitor.exec(sheet, imports.toArray(new JClassType[imports.size()])); } } return cssClassNames; }
/** * Returns the set of CSS classnames in the underlying css or gss files. * * @throws UnableToCompleteException if the user has called for a css/gss file we * can't find. */ public Set<String> getCssClassNames() throws UnableToCompleteException { List<URL> urls = getExternalCss(); if (cssClassNames == null) { final File bodyFile = getGeneratedFile(); if (bodyFile != null) { try { urls.add(bodyFile.toURI().toURL()); } catch (MalformedURLException e) { throw new RuntimeException(e); } } assert urls.size() > 0; if (gss) { return GssWrapper.getCssClassNames(bodyFile.getName(), body, imports, logger.getTreeLogger()); } else { CssStylesheet sheet = GenerateCssAst.exec(logger.getTreeLogger(), urls.toArray(new URL[urls.size()])); cssClassNames = ExtractClassNamesVisitor.exec(sheet, imports.toArray(new JClassType[imports.size()])); } } return cssClassNames; }
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); } return doc; }
private Document getW3cDoc(MortalLogger logger, DesignTimeUtils designTime, ResourceOracle resourceOracle, String templatePath, Resource resource) throws UnableToCompleteException { 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); } return doc; }
private Document getW3cDoc(MortalLogger logger, DesignTimeUtils designTime, ResourceOracle resourceOracle, String templatePath, Resource resource) throws UnableToCompleteException { 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); } return doc; }
fieldWriter.getInstantiableType(), handlerType); logger.getTreeLogger().log(Type.INFO, "-------------"); logger.getTreeLogger().log(Type.INFO, "eventType = "+eventType); logger.getTreeLogger().log(Type.INFO, "DomEvent = "+oracle.findType(DomEvent.class.getCanonicalName())); logger.getTreeLogger().log(Type.INFO, "gwtEvent = "+oracle.findType(GwtEvent.class.getCanonicalName())); logger.getTreeLogger().log(Type.INFO, "to DomEvent ?"+eventType.isAssignableTo(oracle.findType(DomEvent.class.getCanonicalName()))); logger.getTreeLogger().log(Type.INFO, "to GwtEvent ?"+eventType.isAssignableTo(oracle.findType(GwtEvent.class.getCanonicalName()))); if (addHandlerMethodType == null) { "." + eventType.getName() + ".getType()", "addDomHandler", objectName); logger.getTreeLogger().log(Type.INFO, "addDomHandler"); } else { writeAddHandler(writer, fieldManager, handlerVarName "addHandler", objectName); logger.getTreeLogger().log(Type.INFO, "super.addHandler");