Example usage for java.awt Window getWindowListeners

List of usage examples for java.awt Window getWindowListeners

Introduction

In this page you can find the example usage for java.awt Window getWindowListeners.

Prototype

public synchronized WindowListener[] getWindowListeners() 

Source Link

Document

Returns an array of all the window listeners registered on this window.

Usage

From source file:org.eclipse.jubula.rc.swing.components.AUTSwingHierarchy.java

/**
 * register a window listener to <code>window</code>.<br> deregistering happens in
 * <code>WindowClosingListener.windowClosed()</code>.
 * @param window the window to register to
 *//*from w w  w.  j a va2  s .  c  o  m*/
private void registerAsWindowListener(final Window window) {
    Runnable registrationRunnable = new Runnable() {

        public void run() {
            if (log.isInfoEnabled()) {
                log.info("registering window listener to window " //$NON-NLS-1$
                        + window);
            }
            WindowListener[] listener = window.getWindowListeners();
            for (int i = 0; i < listener.length; i++) {
                if (listener[i] instanceof WindowClosingListener) {
                    return;
                }
            }
            window.addWindowListener(new WindowClosingListener());
        }
    };

    registerListener(registrationRunnable);
}