Home » Eclipse Projects » Eclipse Platform » IMemento for IEditorInput.saveState() only saves text data once?
IMemento for IEditorInput.saveState() only saves text data once? [message #293850] |
Mon, 31 October 2005 11:37  |
Eclipse User |
|
|
|
Originally posted by: chris.nospam.net
I have implemented an editor and my own input class for that editor.
When the input.saveState() method is called, I save some information
for the input using the IMemento.putTextData() method. When the
workbench restores and the editor is reactivated, I can re-read that
data and successfully re-init my editor using that information.
However, if I restart the workbench and DO NOT activate a particular
editor, when the workbench shuts down, the "text data" part of the
memento no longer appears on the workbench.xml file. When the editor
is restored, IMemento.getTextData() now returns null, so my editor
cannot restore it's state.
It was not obvious to me from the javadocs that the IMemento.putTextData()
cannot really be used for storing editor properties. Is this a bug or
am I mis-understanding the intended behavior?
To summarize...if I:
1) start workbench, open my editor and then select some OTHER editor
2) restart workbench and then shut it down
3) restart workbench and activate my editor
Then the IMemento.getTextData() returns null.
If I select the editor in step 2, then it always restores fine in both
step 2 and 3.
TIA,
C
--
************************************
Chris Merrill
st.ng4@christophermerrillZZZ.net
(remove the ZZZ to contact me)
************************************
|
|
|
Re: IMemento for IEditorInput.saveState() only saves text data once? [message #293857 is a reply to message #293850] |
Mon, 31 October 2005 13:05   |
Eclipse User |
|
|
|
Chris Merrill wrote:
> I have implemented an editor and my own input class for that editor.
> When the input.saveState() method is called, I save some information
> for the input using the IMemento.putTextData() method. When the
> workbench restores and the editor is reactivated, I can re-read that
> data and successfully re-init my editor using that information.
>
> However, if I restart the workbench and DO NOT activate a particular
> editor, when the workbench shuts down, the "text data" part of the
> memento no longer appears on the workbench.xml file. When the editor
> is restored, IMemento.getTextData() now returns null, so my editor
> cannot restore it's state.
What's happening is if you don't activate the editor, the IEditorPart is
not being restored ... if it was your editor that did saveState(), you
would expect that the next time you started the workbench and activated
it, you'd get your memento (that's how views work).
What's going wrong is that even though your editor is not being
instantiated, your editor input is (so it can be handed to your editor
reference) ... which chews up your memento.
Sounds like a lifecycle bug to me (a painful one as well). Could you
please open a bug
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Platform against
Platform UI. Please include your use case and eclipse platform
information (build, OS, etc).
Thanx,
PW
|
|
|
Re: IMemento for IEditorInput.saveState() only saves text data once? [message #293861 is a reply to message #293857] |
Mon, 31 October 2005 13:24   |
Eclipse User |
|
|
|
Originally posted by: chris.nospam.net
Paul Webster wrote:
> What's happening is if you don't activate the editor, the IEditorPart is
> not being restored ... if it was your editor that did saveState(), you
> would expect that the next time you started the workbench and activated
> it, you'd get your memento (that's how views work).
Yup...that was my understanding.
> What's going wrong is that even though your editor is not being
> instantiated, your editor input is (so it can be handed to your editor
> reference) ... which chews up your memento.
That is not what I'm seeing. It suprised me, because that is what behavior
I had designed my input class to handle. I thought that the input.getName()
method was used to populate the tab title for un-activated editors. However,
my input does not get instantiated until the editor is activated. Looking at
the workbench.xml, it looks like the workbench is saving the tab title as a
property in the <editor> memento, and therefore never needs to instantiate
the input until the editor is activated.
> Sounds like a lifecycle bug to me (a painful one as well). Could you
> please open a bug
> https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Platform against
> Platform UI. Please include your use case and eclipse platform
> information (build, OS, etc).
will do.
Thanks,
C
--
************************************
Chris Merrill
st.ng4@christophermerrillZZZ.net
(remove the ZZZ to contact me)
************************************
|
|
| |
Re: IMemento for IEditorInput.saveState() only saves text data once? [message #293876 is a reply to message #293850] |
Tue, 01 November 2005 04:41   |
Eclipse User |
|
|
|
Perhaps this has something to do with
https://bugs.eclipse.org/bugs/show_bug.cgi?id=113659
The fixed version should be available in 3.2 M3.
Peter
Chris Merrill wrote:
> I have implemented an editor and my own input class for that editor.
> When the input.saveState() method is called, I save some information
> for the input using the IMemento.putTextData() method. When the
> workbench restores and the editor is reactivated, I can re-read that
> data and successfully re-init my editor using that information.
>
> However, if I restart the workbench and DO NOT activate a particular
> editor, when the workbench shuts down, the "text data" part of the
> memento no longer appears on the workbench.xml file. When the editor
> is restored, IMemento.getTextData() now returns null, so my editor
> cannot restore it's state.
>
> It was not obvious to me from the javadocs that the IMemento.putTextData()
> cannot really be used for storing editor properties. Is this a bug or
> am I mis-understanding the intended behavior?
>
> To summarize...if I:
> 1) start workbench, open my editor and then select some OTHER editor
> 2) restart workbench and then shut it down
> 3) restart workbench and activate my editor
> Then the IMemento.getTextData() returns null.
>
> If I select the editor in step 2, then it always restores fine in both
> step 2 and 3.
>
> TIA,
> C
>
>
|
|
| |
Re: IMemento for IEditorInput.saveState() only saves text data once? [message #294234 is a reply to message #293881] |
Mon, 07 November 2005 11:46  |
Eclipse User |
|
|
|
Originally posted by: bokowski.ca.ibm.com
You might be seeing the following bug, which has not been fixed yet. Please
add yourself to the cc list of that bug if you want to be notified when it
is fixed.
Bug 114386 [Model] IMemento text data is not saved after restore
Boris
"Patrick Paulin" <pjpaulin@yahoo.com> wrote in message
news:e57b0587d4a5056269e6dbbd64f7790f$1@www.eclipse.org...
> I've struggled with similiar issues related to non-initializeed editors.
> I've found it easier to just restore all the editors when the workbench
> starts up.
>
> One scenario I have is that I want the editors to listen to their input
> models, and shut themselves down if the underlying model is deleted in
> another view (e.g. navigator).
>
> Anyway, if it's not too resource intensive to restore your editors, it
> could be a short-term workaround for the memento issue.
>
> --- Patrick
>
>
>
|
|
|
Goto Forum:
Current Time: Fri Jul 25 18:58:02 EDT 2025
Powered by FUDForum. Page generated in 0.09719 seconds
|