Closed pdrasko closed 10 years ago
You would normally want just one editing context per document. The editing context typically owns the current selection and command history (undo/redo). If your child nodes are in the same physical document as the root nodes, then I'm pretty sure you would not want to mix up undo/redos between root nodes and child nodes.
It sounds like you're trying to build a hierarchical finite state machine. If so, the Statechart sample app provides an example of that, since it has hierarchical elements -- Statechart elements can be inside other Statechart elements. The Circuit Editor, too, has a hierarchy through the use of circuit groups which can contain child circuit groups and so on.
To show a FSM editing context in some circumstance, to me, that means that you want to change the active context. In the sample app, we only do that when a different document becomes active. You use the IContextRegistry and set the ActiveContext property. You could set the ActiveContext to a different EditingContext when a non-root node is selected. This sounds a little bit tricky because the FSM's EditingContext is also a selection context (it implements ISelectionContext), so you'll find that if you change the ActiveContext in response to a selection changed event, you'll probably immediately generate another selection changed event.
Did I understand your question correctly?
Hi,
I'm looking to adapt the FSM code in your sample project. The requirement would be to show a FSM editing context when a non-root node in the document is selected.
What is the best way to accomplish this provided that the XSD regarding the FSM nodes is identical to your sample project?
question