|Editor having a child editor [message #491580]
||Thu, 15 October 2009 07:29
| Cedric Moonen
Registered: August 2009
I have an editor, which is a multipage editor for which one page is a form. On this form, there's a button to edit a specific part of the data the editor is displaying. When pressing that button, the data to be edited is opened in a separate editor (for convenience). Thus, this second editor is in fact linked to the first editor and its lifecycle should be partially managed by the parent editor. The child editor is in fact a graphical editor.
What I want is that:
- When the parent editor is closed, the child editor is closed too.
- When that happens, if there are unsaved modifications in the child editor, a message should be displayed to the user asking to save the data BEFORE the parent editor is closed
- The child editor can be closed independently of the parent editor without afecting it.
- When the child editor is saved, the parent editor should be warned and adapt itself (the data from the graphical editor is converted to a string and displayed on the main editor).
I partially managed to reach that solution but it is not fully satisfactory. Waht I did was this:
When I click on the button, I create my own editor input which contains information about the data to open (the file) and a listener for changes (which is in fact the parent editor). Whenever the child editor is saved, it calls the listener changed method and passes the data to it.
I then add a PartListener on my editor and implement the partClosed method to be notified when my parent editor is called and then forwarding it to the part responsible for closing the child editor.
The biggest problem is when closing the parent editor: I should be warned before the editor is closed instead of after because I would like for instance to veto the close of the editor when there are changes in the child editor and userr select cancel when being asked about to save or not the unsaved changes.
I was wondering if there's some kind of built-in mechanism that allows to link an editor to another one. This looks like a quite useful feature.
Could somebody help me here ?
Powered by FUDForum
. Page generated in 0.01684 seconds