Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Using Xtext embedded Editor how to synchronize back the changes ?
Using Xtext embedded Editor how to synchronize back the changes ? [message #1725910] Tue, 08 March 2016 13:30 Go to next message
Nawel Amok is currently offline Nawel AmokFriend
Messages: 18
Registered: November 2013
Junior Member
Hello,

I have followed this example http://fr.slideshare.net/meysholdt/lightweight-xtext-editorsasswtwidgets to integrate the Xtext editor of a grammer I created (BPmodel) in a composite - part of swt form, in a windowbuilder project, where the application that carries the EmbdedEditor is an Eclipse plugin.

The integration works, now I would like to fully use the embeddedEditor and synchronize back the changes with the entries of the users.

The presentation in the attached file gives some indications on how to use partial editors :
public EmbeddedEditorModelAccess createPartialEditor(
String prefix, String editablePart, String suffix,
boolean insertLineBreaks) 

Is it what I should use to allow entering a specific rule of the grammer's model ?

In this case, what should the prefix and the suffix be ? knowing that I don't know in advance what the user will enter..
And how to synchronize back the changes.. I don't know exactly which use case I have : "Simple String edited with tooling and writtenback to the model as a String"
org.eclipse.xtext.resource.XtextResource.update(int, int, String)
public void update(int offset, int replacedTextLength, String newText) 

or "Complete model edited and editable part
should be updated in resource" ??
org.eclipse.xtext.ui.editor.embedded.EmbeddedEditorModelAccess
public void updateModel(String prefix, String editablePart, String suffix)


Anyways how can I get these the elements needed to call the methods update or updateModel ?

Thanks in advance,
Nawel

Re: Using Xtext embedded Editor how to synchronize back the changes ? [message #1728413 is a reply to message #1725910] Mon, 04 April 2016 09:24 Go to previous messageGo to next message
Nawel Amok is currently offline Nawel AmokFriend
Messages: 18
Registered: November 2013
Junior Member
Hello again,

any answers ??

Thank you.
Nawel
Re: Using Xtext embedded Editor how to synchronize back the changes ? [message #1728455 is a reply to message #1728413] Mon, 04 April 2016 13:36 Go to previous messageGo to next message
Miro Spönemann is currently offline Miro SpönemannFriend
Messages: 78
Registered: March 2015
Location: Kiel, Germany
Member

The prefix, editablePart and suffix are just used to create initial content to be shown in the embedded editor. If the user is supposed to write the content from scratch, you can leave these strings empty. If the user should write only a specific part of a document, you can use prefix and suffix to fill out the rest.

As to the question how to synchronize changes back to the source model... this is a very complex question, and there are several approaches to solve this. You can have a look at some example code I created for a conference talk:
https://github.com/spoenemann/xtext-gef
Re: Using Xtext embedded Editor how to synchronize back the changes ? [message #1728478 is a reply to message #1728455] Mon, 04 April 2016 17:16 Go to previous message
Nawel Amok is currently offline Nawel AmokFriend
Messages: 18
Registered: November 2013
Junior Member
Perhaps my question is missleading :
I am asking is how to save what has been entered by the user , do I need to use "update" or "updateModel" ?
knowing that I am using different composites (in which the Xtext editor is embedded) to model differents parts of my Xtext Model.

Thanks in advance
Previous Topic:Is the XText Buckminster wizard still available/supported?
Next Topic:[SOLVED] Change name referenced by cross-reference
Goto Forum:
  


Current Time: Thu Apr 25 09:22:40 GMT 2024

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

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

Back to the top