Skip to main content



      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 17:52 Go to next message
Eclipse UserFriend
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 14:14 Go to previous messageGo to next message
Eclipse UserFriend
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 17:49 Go to previous message
Eclipse UserFriend
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: Fri May 16 22:59:27 EDT 2025

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

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

Back to the top