Using MPS inside IntelliJ IDEA

I have been using my language inside IntelliJ Idea. I wanted to get hold on the objects created whilst I write my language. Can any body help me to get hold of the AST generated?
I want to get hold of the modified object as soon as I Save my editor. I got a hint that I have to use Open API, but I have no clue as to how it works. Can anybody help me with that?
10 comments
Hello Kunal,

could I ask you to be more specific about what you want to achieve? I'm slightly puzzled,because the generator does not get invoked when you save the model in your editor, but only when you trigger generation/compilation.
I guess we need more details here.

Cheers,

Vaclav
0
Hi Vaclav,
Thanks for your reply.We have a use case for creating a standalone IDE using MPS by which we can call legacy api if the dsl code on the editor is saved or any event is triggered.We were using xtext for this but since our use case is more closer to a projectional editor , hence we are now migrating to MPS.
I am a novice user of MPS and find difficult to use MPS for my use case.
Can we provide you more details over a call or something which suits you.
Thanks
Kunal
0
Let's use email at this stage - mine is vaclav _at jetbrains.com
0
Guys, can we include me, too? As I could be of help wrt Idea plugin.
daniil.elovkov at jetbrains.com
0
     
    Daniil Elovkov

Added Danill too in the email thread :)
0
Here are few Queries
How MPS can be used to develop and Standalone IDE , Any document,tutorials,links?

How do we track the modified Objects using Open API, I did not find any sample codes or usage?

How to integrate MPS RCP with  MPS language such that if we trigger an event or such as save , we can get the modified object from editor and start writing the logic?

Finally, what’s the best way to get started as far as our use case is concerned. Do you have any suggestions?
0
Answers:

1. This document could help you setup a build script for a standalone MPS IDE - https://confluence.jetbrains.com/display/MPSD31/Building+standalone+IDEs+for+your+languages

2. SModelAccessListener on SModel and SModelChangeListener on EditableModel let you get notified about reads/writes in models.

3.SModelListener on SModel allows you to detect model-scope events, such as saving.

4.You may also like to check out the custom persistence feature (https://confluence.jetbrains.com/display/MPSD31/Custom+Persistence+Cookbook) and consider, whether it is something that can help you.
0
Hi Vaclav,
Thanks for your answers.
Is there any way to run sandbox project as standalone MPS IDE direclty? I am bit confused here :(
Also , where do I need to use SModelAccessListener and SModelListener in the MPS Project, do you have any sample code or usage examples for this?

Cheers

Kunal
0
Hi Kunal,

what we call "standalone" MPS is an IDE dedicated to your custom set of languages. You get a Java application that when started will allow the users to write code in the languages that you have bundled with it and nothing more. It carries all the IDE functionality such as VCS, file storage, editing, refactorings, code generation, but all the language design capabilities will have been removed.

We have documentation for Open API at https://confluence.jetbrains.com/display/MPSD31/Open+API+-+accessing+models+from+code
Please let me know if the information that you're looking for is missing there.

Cheers,

Vaclav
0
Hi Vaclav,

Thanks for all the Info provided. I was able to build MPS RCP as a standalone IDE.
However for Accessing the Model using Open API , I could not do. I saw the documentation @ https://confluence.jetbrains.com/display/MPSD31/Open+API+-+accessing+models+from+code as well as the hands on @ http://confluence.jetbrains.com/pages/viewpage.action?pageId=57281182.
I am not able to understand where we need to write the Java Code and how we can get access to our Models from sandbox which listen changes in Model and do something.

For eg: I have tried Constant example and wants to write Listener logic? Do you have any sample example or code.
For you reference I am attaching my Constant Project where I have create a Solution name PersistenceConstant  and a Model named Listener.

Please suggest !!!

Cheers
Kunal
MPS.zip (82KB)
0

Please sign in to leave a comment.