if (progressMonitor != null && progressMonitor.isCanceled()) {
return null;
}
final ASTParser parser = ASTParser.newParser(SHARED_AST_LEVEL, input);
if (parser == null) {
return null;
}
if (progressMonitor != null && progressMonitor.isCanceled()) {
return null;
}
final Program root[] = new Program[1];
SafeRunner.run(new ISafeRunnable() {
public void run() {
try {
if (progressMonitor != null && progressMonitor.isCanceled()) {
return;
}
if (DEBUG) {
System.err
.println(getThreadName()
+ " - " + DEBUG_PREFIX + "creating AST for: " + input.getElementName()); //$NON-NLS-1$ //$NON-NLS-2$
}
root[0] = (Program) parser.createAST(progressMonitor);
// mark as unmodifiable
ASTNodes.setFlagsToAST(root[0], ASTNode.PROTECT);
} catch (OperationCanceledException ex) {
return;