save editor state [message #484557] |
Tue, 08 September 2009 08:30 |
Eclipse User |
|
|
|
Originally posted by: muammer.eroglu.gmail.com
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
|
|
|
Re: save editor state [message #485242 is a reply to message #484557] |
Thu, 10 September 2009 22:04 |
Patrick Paulin Messages: 42 Registered: July 2009 |
Member |
|
|
Hi Muammer,
Make sure IEditorInput.exists() returns true. This always trips me
up ;)
--- Patrick
Patrick Paulin
Eclipse RCP/OSGi Trainer and Consultant
Modular Mind
www.modumind.com
twitter.com/pjpaulin
On 09-08-2009, Muammer Eroglu <muammer.eroglu@gmail.com> wrote:
> 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
--
I'm trying a new usenet client for Mac, Nemo OS X, since 0 days.
You can download it at http://www.malcom-mac.com/nemo
|
|
|
Powered by
FUDForum. Page generated in 0.03443 seconds