[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.rcp] save editor state
|
Hello,
I've an RCP application that has an editor part, and I'd like to save
the state of this editor, that is, remember the files that are open when
the application was closed, and reopen them when the app is restarted.
I've searched this subject on the web, read articles, newsgroup posts,
yet I couldn't make it work, the app starts with a blank editor all the
time.
These are the steps that I'm following. Is there anything wrong here?
1. ApplicationWorkbenchAdvisor / initialize(*) ->
configurer.setSaveAndRestore(true);
2. Register an extension point for org.eclipse.ui.elementFactories
and create an EditorInputFactory class implementing IElementFactory
3. Implement IPersistableElement interface with EditorInput class (which
also implements IEditorInput)
4. EditorInput / getPersistable() ->
return this;
5. EditorInput / getFactoryId() ->
return the id of the registered org.eclipse.ui.elementFactories extension
6. EditorInput / saveState(IMemento) ->
put the filename to the IMemento
7. EditorInputFactory / createElement(IMemento) ->
get the filename string from the IMemento,
return new EditorInput(filename);
Thanks in advance,
Muammer