Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Re: Intercepting editor close event
Re: Intercepting editor close event [message #307349] Mon, 21 August 2006 09:50 Go to next message
Eclipse UserFriend
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 14: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: Sat Jun 28 06:58:34 EDT 2025

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

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

Back to the top