use of net.vtst.ow.closure.compiler.compile.CompilerRun in project ow by vtst.
the class ClosureCompletionProposalCollector method getProposals.
/**
* Get all the completion proposals which are valid in the given context.
* @return The list of the completion proposals.
*/
public List<ClosureCompletionProposal> getProposals() {
CompilerRun run = context.getCompilerRun();
List<String> qualifiedName = context.getPrefixAsQualifiedName();
if (qualifiedName.isEmpty()) {
try {
return getProposalsFromScope();
} catch (RuntimeException e) {
return Collections.emptyList();
}
} else {
Scope scope = run.getScope(context.getNode());
if (scope == null)
return Collections.emptyList();
JSType type = CompilerRun.getTypeOfQualifiedName(scope, qualifiedName);
if (type == null)
return Collections.emptyList();
else
return getProposalsFromType(type);
}
}
use of net.vtst.ow.closure.compiler.compile.CompilerRun in project ow by vtst.
the class ClosureTextHover method getHoverHTML.
/* (non-Javadoc)
* @see net.vtst.ow.eclipse.js.closure.editor.hover.AbstractTextHover#getHoverHTML(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion)
*/
@Override
protected String getHoverHTML(ITextViewer viewer, IRegion region) {
CompilableJSUnit unit = getJSUnit();
if (unit == null)
return null;
CompilerRun run = getCompilerRun(unit);
if (run == null)
return null;
Node node = run.getNode(unit, region.getOffset());
if (node == null)
return null;
JSElementInfo info = getElementInfo(run, node);
if (info == null)
return null;
return info.getHTMLStringForHover();
}
use of net.vtst.ow.closure.compiler.compile.CompilerRun in project ow by vtst.
the class ClosureBuilder method compileJavaScriptFile.
/**
* Compile a JavaScript file.
*/
private void compileJavaScriptFile(IFile file, CompilerOptions options, boolean fileIsOpen, boolean stripIncludedFiles, boolean doNotKeepCompilationResultsOfClosedFilesInMemory, boolean force) throws CoreException {
OwJsDev.log("Compiling %s", file.getFullPath().toOSString());
CompilableJSUnit unit = ResourceProperties.getJSUnit(file);
if (unit == null)
return;
ErrorManager errorManager = new ErrorManagerForFileBuild(unit, file);
boolean keepCompilationResultsInMemory = !doNotKeepCompilationResultsOfClosedFilesInMemory || fileIsOpen;
boolean force2 = force || editorRegistry.isNewlyOpenedFile(file);
CompilerRun run = unit.fullCompile(options, errorManager, keepCompilationResultsInMemory, stripIncludedFiles, force2);
run.setErrorManager(new NullErrorManager());
}
Aggregations