Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext <-EMF->GMF
Xtext <-EMF->GMF [message #640173] Fri, 19 November 2010 13:06 Go to next message
No real name is currently offline No real nameFriend
Messages: 12
Registered: October 2010
Junior Member
Hi,

I've got a basic questions about the connections between the 3 frameworks in the tilte.

I've been searching, finding and coding a lot to get a xtext dsl script visualized in an gmf editor. The gmf integration example from xtext has been very useful there. Now I want to embed the xtext editor as well as the gmf editor in one multipageeditor. There is a lot of noise also in this forum.

What I found since, is some tutorials about embedding gmf editor into emf multipageditor.

The connection between GMF-> Xtext is over the implemtation of the Xtext Resource right?
It is the implementation of the EMF's abstract resource, so EMF is the controlling "brain" behin this.

Why isn't it posssible to embed the xtext editor as "easy" as the gmf editor into the emfs multipageeditor, it should be tkind of the opposite direction?

greets Tim
Re: Xtext <-EMF->GMF [message #641149 is a reply to message #640173] Wed, 24 November 2010 12:32 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 12
Registered: October 2010
Junior Member
maybe the question has been to abstract in first place.

To be more specific:
I want to embed an Xtext Editor into an MultiPageEditor.

whaat I got so far

- a Class MultiPageEditor extends MultiPageEditorPart, which adds the pages in createPages(). There I add a normal SelectionTree and an GMF Diagram Editor, like this

createPages(){
//...
diagrEditor = new DiagramEditor();
pageindex = addPage(diagrEditor, getEditorInput());
//...
}

- I have written my own XtextEditor extending the XtextEditor class and registering it in the UIModule.

Now when i add the Editor to createPages() like the editor above, i get an XtextEditor.init error, that the documentProvider is null.

Do I also have to implement my own ?
Which methods should be implemented?
Which methods do I have to implement in my own XtextEditor ?

Are ther any other suggestions or better ideas to make this work ?
Thanks 4 ur help
Re: Xtext <-EMF->GMF [message #641166 is a reply to message #641149] Wed, 24 November 2010 13:07 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Am 11/24/10 1:32 PM, schrieb Tim Joussen:
> - I have written my own XtextEditor extending the XtextEditor class and
> registering it in the UIModule.

Did you use guice to obtain an instance of your XtextEditor?

Sven

--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de
Re: Xtext <-EMF->GMF [message #641174 is a reply to message #641166] Wed, 24 November 2010 13:30 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 12
Registered: October 2010
Junior Member
dont think so Wink

public class MyXtextEditor extends XtextEditor{
//..
}

UIModule :
public Class<? extends XtextEditor> bindEditor(){
return MyXtextEditor.class;
}
thats "all" I've done

In addition I implemented an Documentprovider in the same way and overridden the setDocumentProvider() method. But all i get out of myXtextEditor.getDocumentProvider() is NULL.

Maybe GUICE is the thing here I dont understand...
Re: Xtext <-EMF->GMF [message #641200 is a reply to message #641174] Wed, 24 November 2010 14:29 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Am 11/24/10 2:30 PM, schrieb Tim Joussen:
> dont think so ;)
>
> public class MyXtextEditor extends XtextEditor{
> //..
> }
>
> UIModule : public Class<? extends XtextEditor> bindEditor(){
> return MyXtextEditor.class;
> }
> thats "all" I've done
>
> In addition I implemented an Documentprovider in the same way and
> overridden the setDocumentProvider() method. But all i get out of
> myXtextEditor.getDocumentProvider() is NULL.
> Maybe GUICE is the thing here I dont understand...
>
How do you create the instance of your editor?
Using the constructor like for the DiagramEditor?

createPages(){
//...
diagrEditor = new DiagramEditor();
pageindex = addPage(diagrEditor, getEditorInput());
//...
}

You need to create the instance using the guice.
You should register your MultipageEditor in the plugin.xml using the
executableextension factory (see how the original XtextEditor is
configured).
In addition you should have something like

@Inject
private Provider<XtextEditor> editorProvider;

and in createPages() you do something like this:

pageindex = addPage(editorProvider.get(), getEditorInput());

hth,
Sven

--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de
Re: Xtext <-EMF->GMF [message #641384 is a reply to message #641200] Thu, 25 November 2010 09:42 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 12
Registered: October 2010
Junior Member
Thanks for your quick answer!

But the prob isnt solved yet.

1. Implemented own XtextEditor
2. registered in UiModule
3. Injected the XtextEditorProvider in MultipageEditor class
4. Added an extension pointing to the MultiPageEditor in the plugin.xml in the .ui Project from Xtext.

-> The provider in the MultipageEditor stays NULL. Do I have to add the extension elsewhere ?

Tim
Re: Xtext <-EMF->GMF [message #641428 is a reply to message #641384] Thu, 25 November 2010 12:44 Go to previous message
No real name is currently offline No real nameFriend
Messages: 12
Registered: October 2010
Junior Member
k, i got it.

Certainly, when the gmf editor is started there is no xtext resource loaded.

To come back to my first post. For example gmf provides a transactionaleditingdomain, which has to be integrated into the multipageeditor. Is there a similar way in xtext ?
Maybe one of you has got some tips to do that. To do the emf->gmf integration there are some tutorials out there, but the other way round to do emf->xtext nowhere to find anything Sad
Previous Topic:Help with content assist
Next Topic:[SOLVED] Content Assistent not working as expected
Goto Forum:
  


Current Time: Tue Apr 23 14:41:37 GMT 2024

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

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

Back to the top