Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » JFace close button(Proper technique)
JFace close button [message #777694] Tue, 10 January 2012 22:32 Go to next message
Bill Brandley is currently offline Bill BrandleyFriend
Messages: 12
Registered: October 2011
Junior Member
I created a JFace application containing a "Close" button. In the "mouseUp" event, I placed:

Display.getCurrent().dispose();

I modified main() thusly:

if(Display.getCurrent() != null) {
Display.getCurrent().dispose();
}

Is this a reasonable way to code a JFace close application from a button? What is the preferred method of accomplishing this?

Thanx,
Bill
Re: JFace close button [message #778182 is a reply to message #777694] Wed, 11 January 2012 14:34 Go to previous message
Daniel Krügler is currently offline Daniel KrüglerFriend
Messages: 853
Registered: July 2009
Senior Member
On 2012-01-10 23:32, Bill Brandley wrote:
> I created a JFace application containing a "Close" button. In the
> "mouseUp" event, I placed:
>
> Display.getCurrent().dispose();
>
> I modified main() thusly:
>
> if(Display.getCurrent() != null) {
> Display.getCurrent().dispose();
> }
>
> Is this a reasonable way to code a JFace close application from a
> button? What is the preferred method of accomplishing this?

I would instead call the "close" function from the shell:

"* Requests that the window manager close the receiver in
* the same way it would be closed when the user clicks on
* the "close box" or performs some other platform specific
* key or mouse combination that indicates the window
* should be removed."

This seems to be the more appropriate action to me. Display.close is
more drastically and does not give corresponding promises. It should be
invoked after the disposal of the shell, though.

HTH & Greetings from Bremen,

Daniel Krügler
Previous Topic:Question about ImageDescriptor
Next Topic:[databinding] Whats is the minimum to bind a custom model
Goto Forum:
  


Current Time: Tue Mar 19 11:58:18 GMT 2024

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

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

Back to the top