Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to handle window closing event?
How to handle window closing event? [message #449337] Fri, 21 January 2005 22:21 Go to next message
Bill Ewing is currently offline Bill EwingFriend
Messages: 49
Registered: July 2009
Member
In our JFace app, we have an action for the traditional "File, Exit." In
it, we save some properties to a file.

When we close our app using the X button in the upper right corner of the
window, however, this action does not get invoked.

How do we trap this event?

And, is there a way to abort closing a window?

TIA, Bill
Re: How to handle window closing event? [message #449352 is a reply to message #449337] Sun, 23 January 2005 12:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: v.j.b

> How do we trap this event?

> And, is there a way to abort closing a window?

Bill, have you ever considered using the search
(http://www.eclipse.org/search/search.cgi) ?

you seem to come accross a lot of 'problems' that are frequently asked
around here.

just a suggestion.
Re: How to handle window closing event? [message #449471 is a reply to message #449352] Tue, 25 January 2005 12:05 Go to previous messageGo to next message
Max is currently offline MaxFriend
Messages: 28
Registered: July 2009
Junior Member
In article <ct04ck$l4g$1@www.eclipse.org>, v@j.b says...
> > How do we trap this event?
>
> > And, is there a way to abort closing a window?
>
> Bill, have you ever considered using the search
> (http://www.eclipse.org/search/search.cgi) ?
>
> you seem to come accross a lot of 'problems' that are frequently asked
> around here.
>
> just a suggestion.

But anyway here's a short example adapted from a project I'm working on:

shell.addShellListener(new GuiAdapter());
....
private class GuiAdapter extends ShellAdapter
{
public void shellClosed(ShellEvent e)
{
if (!checkQuit())
e.doit = false; // Don't close gui!
else
controller.shutdown();

}
}

Another suggestion: Before you start using JFace and/or a GUI builder
it's perhaps a good idea to try and write some SWT gui's by hand. Just
to get a feel for how it works.
--
Regards Max rotvel AT bolignet-aarhus DOT dk
Re: How to handle window closing event? [message #449589 is a reply to message #449352] Wed, 26 January 2005 19:03 Go to previous messageGo to next message
Bill Ewing is currently offline Bill EwingFriend
Messages: 49
Registered: July 2009
Member
varname wrote:

> you seem to come accross a lot of 'problems' that are frequently asked
> around here.

Varname, my recent post on "javaw.exe keeps running" resulted in the maker
of SWT/JFace GUI designer plug-in fixing what might be considered a bug in
their product.

Another recent post on handling close events in JFace windows resulted in
same manufacturer adding an important feature to their product.

I feel good about having contributed to the advancement of this GUI
designer which is probably the very best in its class, and is certainly
the most important plug-in we've seen.

Looking back at other posts, it seems that often discussion and snippets
applied to pure SWT but not JFace or our specific situation.
Re: How to handle window closing event? [message #449684 is a reply to message #449589] Fri, 28 January 2005 00:37 Go to previous message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
.... well, it is the SWT newsgroup. The JFace one is eclipse.platform.

"Bill Ewing" <ewing@irori.com> wrote in message
news:ct8pi4$6s1$1@www.eclipse.org...
> varname wrote:
>
> > you seem to come accross a lot of 'problems' that are frequently asked
> > around here.
>
> Varname, my recent post on "javaw.exe keeps running" resulted in the maker
> of SWT/JFace GUI designer plug-in fixing what might be considered a bug in
> their product.
>
> Another recent post on handling close events in JFace windows resulted in
> same manufacturer adding an important feature to their product.
>
> I feel good about having contributed to the advancement of this GUI
> designer which is probably the very best in its class, and is certainly
> the most important plug-in we've seen.
>
> Looking back at other posts, it seems that often discussion and snippets
> applied to pure SWT but not JFace or our specific situation.
>
>
Previous Topic:Browser: Showing current URL in location textfield (what Listener to use?)
Next Topic:Shortcuts in SWT? (accelerators)
Goto Forum:
  


Current Time: Thu Nov 14 21:15:52 GMT 2019

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

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

Back to the top