|
Re: Integrating DSL in TableViewer (XtextResource?) [message #703262 is a reply to message #702354] |
Wed, 27 July 2011 07:13  |
Eclipse User |
|
|
|
Hi Daniel,
>how can I manage to give the user the possibility to right-click on the .mydsl file and choose the TableViewer as Editor
I think you have to implement an EditorPart which contains your Tableviewer and register it via the extension point "org.eclipse.ui.editors".
>And how can I link the ContentProviders ofthe TableViewer with the data from the MyDSL model instance? (I think it will work with the XtextResource, but how do I get the correct one of the instance?)
Xtext registers an org.eclipse.emf.ecore.extension_parser in the ui plugin for your extension (.mydsl) That deals with the resource creation stuff. So you can use the ResourceFactoryRegistry to create the right instance of your resource:
Factory factory = ResourceFactoryRegistryImpl.INSTANCE.getFactory(uri);
Resource resource = factory.createResource(uri);
Assert.true(resource instanceof XTextResource);
Hope this helps,
Andreas
|
|
|
Powered by
FUDForum. Page generated in 0.25145 seconds