Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Strategies for using embedded editor
Strategies for using embedded editor [message #987497] Mon, 26 November 2012 21:15
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 672
Registered: July 2009
Location: Trondheim, Norway
Senior Member
Hi,

I'm (still) working in integrating a Graphiti editor with an Xtext DSL,
more specifically popping up an embedded editor for editing part of the
model as text. I've looked through several code examples and the general
strategy seems to be as follows:

1. Assume the user has selected or otherwise identified the object that
should be edited (call this object EO).
2. Serialize the whole model to a temporary resource and open it as an
XtextResource, effectively reparsing it.
3. Find the text span of EO and open the embedded editor on the
XtextResource and limit the view to EO text span.
4. After editing, merge the content of the XtextResource with the
original model.

A drawback of this approach is that you need to serialize the whole
model, and merge the result back into the original one. This is both
time-consuming and difficult, and seems like overkill for e.g. editing
the type of a connection or port in a process diagram.

An alternative strategy would be to
1. serialize the object that you want to edit and
2. configure the XtextResource and editor to parse using a specific
parse rule (for that object) and
3. use the original model for scoping and linking (and Java model
inference).

This should let you just replace the original EO with the
XtextResource's content instead of merging complete models/resources.
I've managed to do step 1 and 2, by using a special injector and custom
versions of several of the generated services, like the parser, some
factories etc. However, I have problems getting the completion service
to work and I haven't yet looked at scoping and linking.

The question is: Is the alternative strategy feasible or a dead end? If
feasible, are there any hints for how to implement it?

Hallvard
Previous Topic:Assignments and function output have same sintax
Next Topic:linking performance
Goto Forum:
  


Current Time: Sun Sep 27 01:25:03 GMT 2020

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

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

Back to the top