Listening for changes in a node via a plugin


I would like to accomplish the following :

When a reference in a node is changed i would like to execute some code. After reading the documentation and some posts in the forum, the only way i found to do that is by adding a plugin thats puts a listener on that node. If there is an other way plz tell me. Btw the ref is changed within an editor using the possibilites of smart references.


What I did so far is creating an action like suggested in this post :


when i try to define the Editorcontext in the action context parameters , MPS will not give ma that option. As type of paramaters i can ony choose :

model  /  nlist<>   /   node<>,

so no Editor Context or any other options shown in the documentation  ( ).


What  am I doing wrong?


P.S. using 3.3.1




Comment actions Permalink

I have found an alternative solution to my Listener problem. As I am creating the node I want to listen to in an Intention , I could add the Listener to the node there .

Well , thats what I thought. I wrote in the execute of the Intention :




where all the ??? are i wanted to write : "  new SNodeChangeListener(){

"Implementetaiton of the Listener"

}   "


But MPS wont let me choose any kind of Listener Class after I type "new" . Any ideas?

Comment actions Permalink

You need to add the required dependency to your intentions aspect: org.jetbrains.mps.openapi.model@java_stub

Note, to find a model's name you can just search for the node name (e.g., SNodeChangeListener) by pressing ctrl/cmd + n, which gives you the corresponding model.


Please sign in to leave a comment.