Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Re: Intercepting editor close event
Re: Intercepting editor close event [message #307349] Mon, 21 August 2006 13:50 Go to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

cse wrote:
> Hi,
>
> Is there a way to intercept the close event for an eclipse Editor (eg
> when the editor tab's 'X'/close icon is clicked), regardless of the
> editor's dirty state?
> I basically want to show an OK/Cancel dialog before actually closing the
> editor: Clicking 'Cancel' would keep the editor open. Clicking 'OK'
> would continue the normal closing procedure of the editor (ie all the
> standard dirty state checking and providing the built-in
> save-before-close functionality etc).
>

This is a platform question.

But no, there's no closing event sent. Eclipse provides mostly
post-activite events ... i.e. on IPartListener2, partClosed(*) is a
post-closing event.

If you write your own presentation, then in theory you could trap your
close events and not send them to the IStackPresentationSite. But this
is a lot of work.

Later,
PW


Re: Intercepting editor close event [message #307361 is a reply to message #307349] Mon, 21 August 2006 18:37 Go to previous message
Eclipse UserFriend
Originally posted by: bokowski.ca.ibm.com

You can provide your own dialog on close, but it will only be shown if the
editor is dirty at the time it is closed. See
ISaveablePart2.promptToSaveOnClose(). However, note that implementing
ISaveablePart2 may lead to many dialogs being opened when you close multiple
editors.

Boris

"Paul Webster" <pwebster@ca.ibm.com> wrote in message
news:eccdqm$8oq$1@utils.eclipse.org...
> cse wrote:
> > Hi,
> >
> > Is there a way to intercept the close event for an eclipse Editor (eg
> > when the editor tab's 'X'/close icon is clicked), regardless of the
> > editor's dirty state?
> > I basically want to show an OK/Cancel dialog before actually closing the
> > editor: Clicking 'Cancel' would keep the editor open. Clicking 'OK'
> > would continue the normal closing procedure of the editor (ie all the
> > standard dirty state checking and providing the built-in
> > save-before-close functionality etc).
> >
>
> This is a platform question.
>
> But no, there's no closing event sent. Eclipse provides mostly
> post-activite events ... i.e. on IPartListener2, partClosed(*) is a
> post-closing event.
>
> If you write your own presentation, then in theory you could trap your
> close events and not send them to the IStackPresentationSite. But this
> is a lot of work.
>
> Later,
> PW
Previous Topic:Internal Error on closing workbench after installing 3.2
Next Topic:Getting access to some workbench parts
Goto Forum:
  


Current Time: Fri Jun 14 08:01:14 GMT 2024

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

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

Back to the top