Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Integrating DSL in TableViewer (XtextResource?)
Integrating DSL in TableViewer (XtextResource?) [message #702354] Tue, 26 July 2011 08:59 Go to next message
Daniel Trierweiler is currently offline Daniel TrierweilerFriend
Messages: 67
Registered: June 2011
Member
Hello Guys!

I've tested a lot of things since my last questions here. The result was, that I managed to implement a XtextCellEditor in a TableViewer thanks to Andreas Muelder from itemis and the YAKINDU Project. But the performance is really bad once the cellcount exceeds a certain number.

So I lowered my requirements and I just want to link a TableViewer with the xtext file.

Lets say I have MyDSL with .mydsl files and 2 projects org.test.mydsl, org.test.mydsl.ui. I know how to integrate a XtextEditor in the TableViewer, but how can I manage to give the user the possibility to right-click on the .mydsl file and choose the TableViewer as Editor? 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?)

Any input is welcome Smile Thanks!

Greetings,
Daniel
Re: Integrating DSL in TableViewer (XtextResource?) [message #703262 is a reply to message #702354] Wed, 27 July 2011 11:13 Go to previous message
Andreas Muelder is currently offline Andreas MuelderFriend
Messages: 73
Registered: July 2011
Member
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


Previous Topic:[xtext2 xtend2] How to generate one file based on multiple models?
Next Topic:[xtext 2.0] Create Scopes
Goto Forum:
  


Current Time: Fri Apr 16 03:55:29 GMT 2021

Powered by FUDForum. Page generated in 0.01751 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top