[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.rcp] Re: save editor state

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@xxxxxxxxx> 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