I am developing a new plugin for my dsl language (that I used xtext for developing it). In my plugin, I want that for every *.mydsl file, it's should view graph of vars that define in the file that open.
For that, I need to get some EObject that define in the open file. If I would have some EObject, I can travel the AST to get all the vars I need for the graph.
So, I extends ViewPart class, and I tried to find the current file that open in this code:
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
But, I don't know how to get from IWorkbenchPage some EObject type, can someone tell me how I can do it? (or another way that will work)
--------UPDATE:---------
I found it hard to go over the AST of the file by getting EObject (because I wanted to use functions like: EcoreUtil2.getContainerOfType(context, Model) and it's work only in the xtext project.) Instead of finding EObject, is there a way to get the AST of the file? I want all vars of specific types that define in the active file. (The file in the current tab) Thanks!
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); IEditorPart activeEditor = page.getActiveEditor();How can I get the AST of the file? or all the vars of specific types? - RoG