|
|
Re: myEditorPart#saveState(IMemento) not being called [message #332487 is a reply to message #332477] |
Wed, 22 October 2008 15:06 |
Dave Orme Messages: 424 Registered: July 2009 |
Senior Member |
|
|
Thanks for your help, Paul.
I've tried this, and put System.out.printlns in the:
EditorInput#saveState
EditorInputFactory#createElement
Editor#saveState
Editor#restoreState
methods.
For the purposes of the example, my IEditorInput contains a String and
my Editor contains a Text widget. The "text" property of the Editor's
Text widget is data-bound to a property of the EditorInput. The editor
itself has no state that it persists--all of its state is persisted in
the IMemento in the IEditorInput.
Running the example, creating two editors, and typing "Editor 1" into
one and "Editor 2" into the second yields the following output when
shutting down and restarting the application:
Shutdown:>>>>>>>>>>>>>>>>>>>
EditorInput.saveState>>>> Editor 1
EditorInput.saveState>>>> Editor 2
EditorInput.saveState>>>> Editor 2
EditorInput.saveState>>>> Editor 1
EditorInput.saveState>>>> Editor 1
EditorInput.saveState>>>> Editor 2
Startup:>>>>>>>>>>>>>>>>>>>>
CreateElement>>>> Editor 1
and no editors are actually restored.
Notice also that Editor.saveState is never called.
I feel like there must be a "Doh!" somewhere, but am clueless as to
where...
Source code to my example is available at:
http://www.coconut-palm-software.com/~djo/org.eclipse.exampl es.saveditorstate.zip
Thanks in advance,
Dave Orme
On Tue, 2008-10-21 at 19:20 -0400, Paul Webster wrote:
> Those are the 2 main things you need.
>
> Your editor must implement org.eclipse.ui.IPersistableEditor. your
> IEditorInput must return an org.eclipse.ui.IPersistableElement. its
> factory ID must match your org.eclipse.ui.IElementFactory, and you need
> to use the org.eclipse.ui.elementFactories extension to link the ID to
> the factory.
>
> If you've done all the steps and it's still not working, maybe there's a
> bug in the system (although this works for FileEditorInput, amongst
> others). Maybe a bug against Eclipse Platform UI and a small test plugin.
>
> PW
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.07247 seconds