Embeddable MPS

I like MPS editor features, that make possible defining a data scheme and create models conforming to that scheme.

I'm looking for a way to simplify editing complex configuration files for my project.

There configuration files, conforming to some "schema", and using something like MPS editor to edit these configs would be perfect.

However, for many users, that would like to edit these config files, installing MPS and learning how to use it would be too hard.

They don't really need to see concepts declarations, editors, projects, etc, they just need to edit models.

My vision is to create a small "config editor" that will utilize MPS editor.

Something like a small command-line tool, invoked like this: "editConfig myConfigFile.cfg", that will display MPS editor for a model, loaded from that file using custom persistance + OK and Cancel buttons.

That should be possible, given that MPS is open source...
Perhaps, MPS is not designed with this use case in mind but anyway it would be great to try that.

Could you advise, where to start looking at? E.g. a class that actually edits the model (JComponent), and how should it be initialized?

8 comments
Comment actions Permalink

One small addition

Another (more complex) way to use the described configuration editor is to embed it to IDEA as a plugin.

For instance, to edit files with certain extensions. (A good example - log4j config file editor).

That would be really cool. Of course a specialized editor for log4j config files in general is better (more usable from UI perspective), but the point is - to give the user ability to craft their editors easily.

For instance, I don't have time to write a special Idea plugin for a custom file editor, but defining concepts in MPS + providing some persistence adapter class and that using it in Idea is ok.

0
Comment actions Permalink

Hello, Igor,

The use case which you described might be used in many applications. Unfortunately, MPS editor depends on MPS core's components: class loading, smodel, constraints, typesystem, etc, which in turn depends on JetBrains IDE framework. A major refactoring should be performed in order to untie the editor from other parts of IDE and IDEA's stuff. Even worse, if we untie it, we need to create full stack of DSLs for language creation since current language development languages were designed to work inside of MPS. This task is comparable to the task of reimplementing substantial part of MPS from scratch. So, I don't recommend trying to do this.

P.S. We might implement such a feature in the future but now we have a lot of higher priority tasks to do.

Regards,

Konstantin

0
Comment actions Permalink

Igor,

Embedding as IDEA plugin is much easier to perform than to extract editor from MPS. Actually, we have plans to do so and you can expect it in one of the future versions of MPS.

Regards,

Konstantin

0
Comment actions Permalink

Thanks for the answer.

I suspected that it's not trivial to get just the editor.

If the IDEA plugin will be implemented some day, it would be also nice to be somehow integrated with Idea models.

For instance: I'd like to edit my config files in MPS editor, and be able to pick names of classes from Idea project (pehaps filtered out by some logic, e.g. specially annotated classes only). In fact, log4j configs are similar in that sense - class names are often used as logger names.

Ideally, if it would be possible to create a custom editor for user-defined files without coding, just by designing concepts+editors and e.g. specifying file format as a "mapping" between smodel and xml/properties file - that would be absolutely incredible.

0
Comment actions Permalink

Hello Igor,

for your use case a better solution would probably be to use Eclipse with openArchitectureWare (sorry for recommending a competitor's tool in Jetbrains forum). There you are also able to create a Meta-Model with constraints and so on, but Eclipse could be configured to run just the generated editor, which is also able to read and write normal text files - just like the configuration files are that you mentioned. Seems it meet your requirements better, especially because MPS' editor is not able to read and parse already existing configuration files.

Best regards,

jens

0
Comment actions Permalink

Jens,

In respect of embedding DSL editor inside of external application, oAW isn't any better than MPS. In case of MPS you have to use JetBrains IDE framework. In case of oAW you have to use Eclipse Platform.

Regards,

Konstantin

0
Comment actions Permalink

Well right - but you can easily configure the Eclipse platform to offer just the desired editor. In case of Jetbrains IDE framework it seemed to me from your answer that there are some deep cuts in the architecture necessary.

And you cant load and edit existing files. (A feature I'm missing somewhat - are there any plans to create a parser/meta-parser/??? to transform files in ASTs in a future version?)

Best regards,

jens

0
Comment actions Permalink

You can create 'Plugin' entry for your language that will parse any files and transform them to your language on demand.

This is highly-specific to your domain and its language, so it will cannot be part of MPS.

0

Please sign in to leave a comment.