Skip to main content



      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 08:30 Go to next message
Eclipse UserFriend
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 05:24 Go to previous messageGo to next message
Eclipse UserFriend
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 09:36 Go to previous messageGo to next message
Eclipse UserFriend
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 13:16 Go to previous message
Eclipse UserFriend
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: Wed Jul 23 22:28:02 EDT 2025

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

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

Back to the top