Skip to main content

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:How to get filtered elements in a viewer ?
Next Topic:Chaining content assist's in an editor
Goto Forum:

Current Time: Tue May 22 02:39:18 GMT 2018

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

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

Back to the top