Re: Intercepting editor close event [message #307349] |
Mon, 21 August 2006 13:50 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
|
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
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
|
|
|
Re: Intercepting editor close event [message #307361 is a reply to message #307349] |
Mon, 21 August 2006 18:37 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.03722 seconds