Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » save editor state
save editor state [message #484557] Tue, 08 September 2009 08:30 Go to next message
Eclipse UserFriend
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 Go to previous message
Patrick Paulin is currently offline Patrick PaulinFriend
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
Previous Topic:Calling a command guru: editor menu enablement
Next Topic:General Question about Handlers & Commands
Goto Forum:
  


Current Time: Tue Apr 23 12:17:43 GMT 2024

Powered by FUDForum. Page generated in 0.02631 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top