Events/Callbacks related to Program Tree changes

Summary

As a UR+ developer, I would like the ProgramNodeContribution to have events/callbacks that would be called when the program tree changes under my program node.

What is it?

A callback that could be invoked every time something changes in the tree. The implementation would very much resemble how getTitle() and isDefined() are implemented.

Here are some events that I believe could be useful to have:

Node in the sub tree was:

  • Inserted
  • Deleted
  • Cut
  • Pasted
  • Moved

Why is it needed?

As of this moment, there is no proper way of knowing when the tree was changed by the end user and therefore very problematic to develop a functionality that requires knowing when the user has moved or deleted a node. Especially since a contribution stays in memory (probably related to the undo/redo feature) and there is no way to know if it still exists or not in the actual program tree.

9 Likes

This feature would indeed be very useful. E.g. it is not feasible to start a thread inside a new ProgramNode, as there is no way of knowing when to kill that thread again - and there a quite a few other memory related problems associated to not knowing the state of the ProgramNode.