First of all, thank you very much for the time you spend on RSyntaxTextArea. I'm using it on several places in my XULRunner based application. My question is the following:
Imagine two panes, left and right, in the left pane is a tree structure (this represents an XML document) in the right pane is a RSyntaxTextArea embedded as an applet in a XUL document. The user can select nodes in the tree, on selecting a node the text stored with that node must be made editable in the RSyntaxTextArea, on selecting another node the text for that other node is made editable in the RSyntaxTextArea. (The 'text' for each node is stored as a String, not as a file). This all works perfectly.
The problem comes when undo'ing edits, the RTextArea's undoManager has no idea certain edits only relate to 1 node in the tree.
What I wish to do is 'save' all edits before switching tree nodes and restore the edits before showing text for another node. I thought of doing this in several ways
- have 1 RSyntaxTextArea instance per tree node (this will not work since there can be > 100 nodes and several trees)
have 1 AbstractDocument per tree node and call RTextArea.setDocument() (will this do what I want?)
force access to "private transient RUndoManager undoManager;" (using reflection?) and create 1 instance of RUndoManager per tree node and switch that on switching selected node in the tree
Can you please advise on how to crack this problem?
Thanks and greetings,
Dennis de Klerk
Btw. I'm a beginner when it comes to Java and Swing