How to open a property from an EMF element in Eclipse in an editor?

I am developing an EMF model and a user interface with different views. I also use the generated editor from EMF.

Each element has different properties that can be shown in the Properties-View. But especially when writing large text (fe description for an element), I do not want to edit this property in a small line in Properties-View. I want to change this property in a standard editor, where I can take full advantage of the editor. How can i do this?

Change Perhaps I can think of the following: creating a Temp file with content-contents, opening this file in the editor, reading the saved content after saving the file (I still don’t know how to cause the property to be updated when saving the file) and delete the file.

+6
source share
1 answer

Check out the Xtext . Xtext lets you create clean text editors for your EMF models. They are called DSL editors because they usually only support a subset of the functions of a complete programming language.

When writing an Xtext grammar, you need to create a structure that resembles your existing model (you especially need to use the same names). Then Xtext will create a text editor for your EMF model.

The Xbase project contains, among other things, support code for multi-line strings.

Another alternative is to create your own property view for your model, which shows large fields for some properties.

Finally, I saw a demo of the new editor of the EMF model called " EEF " in Eclipse Financial Day 2014, which is based on Sirius . See page 43 presentation slides on slideshare.net .

[EDIT]

I just need to open and edit the property value of the EMF element in a simple default text editor.

You need to tell Eclipse what you want. The way to do this is to write a plugin that connects the different parts. Unfortunately, the EMF editor does not support any configuration by default. If you create an editor for your model, you can customize the field editors (for example, make them larger).

To edit in a regular text editor, you need to open the editor, get the value of the EMF property, create a document, attach it to the editor and paste it into "Save" so that you can set the changes back to the model.

+2
source

Source: https://habr.com/ru/post/978508/


All Articles