Example usage for com.google.gwt.resources.css ExtractClassNamesVisitor exec

List of usage examples for com.google.gwt.resources.css ExtractClassNamesVisitor exec

Introduction

In this page you can find the example usage for com.google.gwt.resources.css ExtractClassNamesVisitor exec.

Prototype

public static Set<String> exec(CssStylesheet sheet, JClassType... imports) 

Source Link

Document

Extract all CSS class names in the provided stylesheet, modulo those imported from another context.

Usage

From source file:fr.onevu.gwt.uibinder.rebind.model.ImplicitCssResource.java

License:Apache License

/**
 * Returns the set of CSS classnames in the underlying .css files.
 *
 * @throws UnableToCompleteException if the user has called for a .css file we
 *           can't find./*from   www  .  ja va 2s  .  c o m*/
 */
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;

        CssStylesheet sheet = GenerateCssAst.exec(logger.getTreeLogger(), urls.toArray(new URL[urls.size()]));
        cssClassNames = ExtractClassNamesVisitor.exec(sheet, imports.toArray(new JClassType[imports.size()]));
    }
    return cssClassNames;
}