public void modelChanged(final SimpleNode ast) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
synchronized (this) {
OutlineCreatorVisitor visitor = OutlineCreatorVisitor.create(ast);
setRoot(new ParsedItem(visitor.getAll().toArray(new ASTEntryWithChildren[0]),
ParsedModel.this.editor.getErrorDescription()));
}
}
});
}
public void errorChanged(final ErrorDescription errorDesc) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
synchronized (this) {
ParsedItem currRoot = getRoot();
ParsedItem newRoot;
if (currRoot != null) {
newRoot = new ParsedItem(currRoot.getAstChildrenEntries(), errorDesc);
} else {
newRoot = new ParsedItem(new ASTEntryWithChildren[0], errorDesc);
}
setRoot(newRoot);
}
}
});
}
};
OutlineCreatorVisitor visitor = OutlineCreatorVisitor.create(editor.getAST());
root = new ParsedItem(visitor.getAll().toArray(new ASTEntryWithChildren[0]), editor.getErrorDescription());
editor.addModelListener(modelListener);
}