Hi,
I need to save my parser tree for use after dltk parse call.
In my DLTK SourceParser:
public class MyMvcSourceParser extends AbstractSourceParser {
public ModuleDeclaration parse(IModuleSource input,
IProblemReporter reporter) {
///Parse my file using ANTLR...
ParseTree my_tree= source.parse()
}
}
In my case, I will use parseTree for many other things.
I tryed make an SigleTon pattern, but I had many problem, if I open 2 o more editors at the same time.
My Editor:
public class MyEditor extends ScriptEditor
{
private ParseTree m_treeParse;
public void setParseTree(ParseTree tree)
{
m_treeParse = tree;
}
}
I want to use my editor like this:
public class MyMvcSourceParser extends AbstractSourceParser {
public ModuleDeclaration parse(IModuleSource input,
IProblemReporter reporter) {
///Parse my file using ANTLR...
ParseTree my_tree= source.parse()
MyEditor editor ....; //I need
editor.setParseTree(my_tree)
}
}
How I access my Editor in parse method?
I've tried this:
IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
But parse method run in another thread, And getActiveWorkbenchWindow returns null.
Any Idea?
Thanks a lot