Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to convert XMI to plain text when opening XTextEditor?
How to convert XMI to plain text when opening XTextEditor? [message #1852390] Fri, 13 May 2022 14:17 Go to next message
jo ber is currently offline jo berFriend
Messages: 86
Registered: August 2018
Member
Hi

I've defined a specific domain model in ecore. The instances of this model are serialized in XMI. I've also dedicated sirius representation for diagram and table edition. Now, I would like to also have a textual edition of these instances and naturally thought to use XText. I've create the xtext grammar and generated the code for this dsl, but I'm facing the problem that I'm not sure how to load my instances serialized in XMI and convert into plain text (valid with the grammer) into the XTextEditor.

My idea idea was to extend
org.eclipse.xtext.ui.editor.XtextEditor
to intercept the moment the xmi file is opened and to convert it into plain text and to convert back from plain text to xmi when the edition with XTextEditor is finished. I'm not sure whether this is a correct way to proceed and how to do it. By how to do it, I mean which functions do I have to extend in
org.eclipse.xtext.ui.editor.XtextEditor
when the file is opened and saved to convert the xmi content. Any reference would be useful.

thank you and kind regards
Re: How to convert XMI to plain text when opening XTextEditor? [message #1852405 is a reply to message #1852390] Sat, 14 May 2022 13:23 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14349
Registered: July 2009
Senior Member
for the how you should look into iserializer.
what the correct place is? good question

maybe you can also look into embedded editor which has a dedicated IEditedResourceProvider


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Sat, 14 May 2022 13:24]

Report message to a moderator

Re: How to convert XMI to plain text when opening XTextEditor? [message #1852463 is a reply to message #1852405] Tue, 17 May 2022 09:26 Go to previous message
jo ber is currently offline jo berFriend
Messages: 86
Registered: August 2018
Member
Hi
Thank you for the answer. This thread also helped me: https://www.eclipse.org/forums/index.php/m/1764784/?srch=XMI#msg_1764784
Kind regards
Previous Topic:Error: "Message could not be parsed" in Socket Mode
Next Topic:Missing generated Activator class in *.*.ui/src-gen folder
Goto Forum:
  


Current Time: Sun Sep 25 08:35:27 GMT 2022

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

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

Back to the top