Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Is it possible to stop an editor from being restored if it is open when the workbench is closed?
Is it possible to stop an editor from being restored if it is open when the workbench is closed? [message #528271] Mon, 19 April 2010 21:52 Go to next message
Alan Boxall is currently offline Alan BoxallFriend
Messages: 12
Registered: July 2009
Junior Member
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.
Re: Is it possible to stop an editor from being restored if it is open when the workbench is closed? [message #528503 is a reply to message #528271] Tue, 20 April 2010 18:14 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Alan Boxall wrote:
> 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()).

PW



--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Is it possible to stop an editor from being restored if it is open when the workbench is closed? [message #528546 is a reply to message #528503] Tue, 20 April 2010 21:49 Go to previous message
Alan Boxall is currently offline Alan BoxallFriend
Messages: 12
Registered: July 2009
Junior Member
Paul Webster wrote:
> 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.
Previous Topic:Need to reset a plugin back to INSTALLED state
Next Topic:IWorkbenchPartSite vs IWorkbenchSite vs IWorkbenchPart vs IWorkbenchPage
Goto Forum:
  


Current Time: Thu Apr 25 09:27:30 GMT 2024

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

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

Back to the top