Add a tool that subscribes to editor changes

Hey everybody,

I would like to add a tool that displays an outline of the opened root node of my DSL.

I found and studies the following examples:

https://www.jetbrains.com/help/mps/howto-adding-additional-tools-aka-views.html
https://www.jetbrains.com/help/mps/dive-into-plugins-the-plantmps-plugin.html

The first examples contains a class “ToolSynchronizer”. I cannot find it but it looks quite interesting.

Is the source code somewhere available?

I found FileEditorManagerListener, studied ContextActionTool and some Mbeddr source code..
The first works but is not the listener I am looking for. The other two are quite large and look too complicated.

 

Isn’t there a simple solution

  • to access the currently opened root node (to travers this node), and
  • listen to content changes and selection changes?

 

Best
Sven

0
2 comments

To listen to the selection use GlobalSelectionListener from MPS extensions.

To listen to content changes use SRepositoryContentAdapter.

To traverse the node use MPS Open API, https://www.jetbrains.com/help/mps/open-api-accessing-models-from-code.html

Does this help?

0

Thanks for your replay, Sergej.

The first sounds like the class I was looking for. I will check it soon.

0

Please sign in to leave a comment.