Example usage for com.google.gwt.dev.util DefaultTextOutput indentOut

List of usage examples for com.google.gwt.dev.util DefaultTextOutput indentOut

Introduction

In this page you can find the example usage for com.google.gwt.dev.util DefaultTextOutput indentOut.

Prototype

public void indentOut() 

Source Link

Usage

From source file:uk.co.thinkofdeath.mapviewer.linker.WorkerLinker.java

License:Apache License

@Override
public ArtifactSet link(TreeLogger logger, LinkerContext context, ArtifactSet artifacts)
        throws UnableToCompleteException {
    ArtifactSet set = new ArtifactSet(artifacts);
    DefaultTextOutput output = new DefaultTextOutput(true);

    Set<CompilationResult> results = artifacts.find(CompilationResult.class);
    CompilationResult result = results.iterator().next();

    output.print("(function() {");
    output.indentOut();
    output.newline();//from  w  w w  .  j  a  v  a 2s  .c  o m
    output.print("var $wnd = self, window = self, $doc = {compatMode:false},"
            + "$stats = function(){}, $sessionId = function(){};");
    output.newline();
    output.print(result.getJavaScript()[0]);
    output.newline();
    output.print("gwtOnLoad(null, '" + context.getModuleName() + "', null);");
    output.indentIn();
    output.newline();
    output.print("})();");

    set.add(emitString(logger, output.toString(), context.getModuleName() + ".js"));
    return set;
}