diff options
Diffstat (limited to 'tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug217324_ActivateEventDialog.java')
-rw-r--r-- | tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug217324_ActivateEventDialog.java | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug217324_ActivateEventDialog.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug217324_ActivateEventDialog.java new file mode 100644 index 0000000000..d8d813b29c --- /dev/null +++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug217324_ActivateEventDialog.java @@ -0,0 +1,68 @@ +/******************************************************************************* + * Copyright (c) 2018 Red Hat and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Red Hat - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.tests.gtk.snippets; + + +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.*; + +public class Bug217324_ActivateEventDialog +{ + + public static void main(String[] args) + { + Display display = new Display(); + display.addFilter(SWT.Activate, new Listener() + { + @Override + public void handleEvent(Event event) + { + System.out.println("activate: " + event); + } + }); + + display.addFilter(SWT.Deactivate, new Listener() + { + @Override + public void handleEvent(Event event) + { + System.out.println("deactivate: " + event); + } + }); + + Shell shell = new Shell(display); + shell.setText("Shell"); + shell.setSize(200, 200); + System.out.println("before widget.shell open"); + shell.open(); + System.out.println("after widget.shell open"); + + System.out.println("set visible false before"); + shell.setVisible(false); + System.out.println("set visible false after"); + + Shell dialog = new Shell(shell); + dialog.setText("Dialog"); + dialog.setSize(200, 200); + System.out.println("before dialog open"); + dialog.open(); + System.out.println("after dialog open"); + + // When dialog is closed no activate event + + while (!shell.isDisposed()) + { + if (!display.readAndDispatch()) + display.sleep(); + } + display.dispose(); + } +}
\ No newline at end of file |