Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » How to dispose ApplicationWindow
How to dispose ApplicationWindow [message #520027] Wed, 10 March 2010 21:20 Go to next message
Ilja is currently offline IljaFriend
Messages: 1
Registered: March 2010
Junior Member
Hi all,
maybe this is a beginner question, but this is a hobby project of mine.
I have problems terminating my programm cleanly. Below is my code. So
when I close the window the task will not be treminated completely (no
Finished! writing in the console). What I am missing here to terminate
the applicationwindow? I tried it even without any content created ...


public class AVC extends ApplicationWindow {

private AVC(Shell shell) {

protected Control createContents (Composite parent) {
getShell().setText ("Das namenlose Programm");
getShell().setSize(1000, 700);

return new Composite (parent, SWT.BORDER | SWT.NULL);

public static void main(String[] args) {
final Display display = new Display();
Realm.runWithDefault(SWTObservables.getRealm(display), new Runnable() {
public void run() {
Shell shell = new Shell(display);
AVC avc = new AVC(shell);
avc.setBlockOnOpen (true);;
while (!shell.isDisposed()) {
if (!display.readAndDispatch())


Re: How to dispose ApplicationWindow [message #520554 is a reply to message #520027] Fri, 12 March 2010 18:50 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Ilja Roganov wrote:

> Shell shell = new Shell(display);
> AVC avc = new AVC(shell);
> avc.setBlockOnOpen (true);

The above code seems fine.

> while (!shell.isDisposed()) {
> if (!display.readAndDispatch())
> display.sleep();
> }
> avc.handleShellCloseEvent();

This code, however, is superfluous. your ran the event loop,
and an avc.close() or Shell close event would have disposed the shell, no?


Paul Webster .platform.doc.isv/guide/workbench.htm

Previous Topic:Chaining content assist's in an editor
Next Topic:Problems with Frame toolkit
Goto Forum:

Current Time: Mon Nov 30 06:17:47 GMT 2015

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

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