Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsIs it possible to stop an editor from being restored if it is open when the workbench is closed?
https://www.eclipse.org/forums/index.php/mv/msg/166632/528271/#msg_528271
on workbench startup.
I don't see anything obvious in the reference help.]]>Alan Boxall2010-04-19T21:52:18-00:00Re: Is it possible to stop an editor from being restored if it is open when the workbench is closed?
https://www.eclipse.org/forums/index.php/mv/msg/166632/528503/#msg_528503
> I have an editor that is open on a file when the workbench is closed and
> I do not want it to re-open on workbench startup.
>
> I don't see anything obvious in the reference help.
It's not the editor that determines re-open, it's the editor input.
org.eclipse.ui.IEditorInput.getPersistable() and exists(), for example.
In the IDE case, I'm not sure how you could make sure those editors
close and aren't persisted, unless you provide your own IEditorInput to
them.
In an RCP app you might be able to close editors that you don't want
persisted in org.eclipse.ui.application.WorkbenchAdvisor.preShutdown()
or one of the other advisor methods (maybe window preClose()).
I am able to supply the editorinput so I tried what you suggested.
FileEditorInput says it is not to be extended so it looks like I'll need to implement an
IFileEditorInput that behaves like a FileEditorInput but returns null for getPersistable().
I ran a quick test by extending FileEditorInput and overriding getPersistable() and it did what I
wanted. Files open at IDE shutdown are not re-opened at the next startup.
Thanks for pointing me in right direction.]]>Alan Boxall2010-04-20T21:49:52-00:00