Index: trunk/src/org/openstreetmap/josm/Main.java
===================================================================
--- trunk/src/org/openstreetmap/josm/Main.java	(revision 11924)
+++ trunk/src/org/openstreetmap/josm/Main.java	(revision 11925)
@@ -7,8 +7,5 @@
 import java.awt.Component;
 import java.awt.GraphicsEnvironment;
-import java.awt.Window;
 import java.awt.event.KeyEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
 import java.io.File;
 import java.io.IOException;
@@ -1160,149 +1157,4 @@
     }
 
-    private static final List<WeakReference<WindowSwitchListener>> windowSwitchListeners = new ArrayList<>();
-
-    /**
-     * Register a window switch listener.
-     *
-     * @param listener the listener. Ignored if <code>null</code>.
-     */
-    public static void addWindowSwitchListener(WindowSwitchListener listener) {
-        if (listener == null) return;
-        synchronized (Main.class) {
-            for (WeakReference<WindowSwitchListener> wr : windowSwitchListeners) {
-                // already registered ? => abort
-                if (wr.get() == listener) return;
-            }
-            boolean wasEmpty = windowSwitchListeners.isEmpty();
-            windowSwitchListeners.add(new WeakReference<>(listener));
-            if (wasEmpty) {
-                // The following call will have no effect, when there is no window
-                // at the time. Therefore, MasterWindowListener.setup() will also be
-                // called, as soon as the main window is shown.
-                MasterWindowListener.setup();
-            }
-        }
-    }
-
-    /**
-     * Removes a window switch listener.
-     *
-     * @param listener the listener. Ignored if <code>null</code>.
-     */
-    public static void removeWindowSwitchListener(WindowSwitchListener listener) {
-        if (listener == null) return;
-        synchronized (Main.class) {
-            // remove the listener - and any other listener which got garbage
-            // collected in the meantime
-            windowSwitchListeners.removeIf(wr -> wr.get() == null || wr.get() == listener);
-            if (windowSwitchListeners.isEmpty()) {
-                MasterWindowListener.teardown();
-            }
-        }
-    }
-
-    /**
-     * WindowListener, that is registered on all Windows of the application.
-     *
-     * Its purpose is to notify WindowSwitchListeners, that the user switches to
-     * another application, e.g. a browser, or back to JOSM.
-     *
-     * When changing from JOSM to another application and back (e.g. two times
-     * alt+tab), the active Window within JOSM may be different.
-     * Therefore, we need to register listeners to <strong>all</strong> (visible)
-     * Windows in JOSM, and it does not suffice to monitor the one that was
-     * deactivated last.
-     *
-     * This class is only "active" on demand, i.e. when there is at least one
-     * WindowSwitchListener registered.
-     */
-    protected static class MasterWindowListener extends WindowAdapter {
-
-        private static MasterWindowListener INSTANCE;
-
-        /**
-         * Returns the unique {@code MasterWindowListener} instance.
-         * @return the unique {@code MasterWindowListener} instance
-         */
-        public static synchronized MasterWindowListener getInstance() {
-            if (INSTANCE == null) {
-                INSTANCE = new MasterWindowListener();
-            }
-            return INSTANCE;
-        }
-
-        /**
-         * Register listeners to all non-hidden windows.
-         *
-         * Windows that are created later, will be cared for in {@link #windowDeactivated(WindowEvent)}.
-         */
-        public static void setup() {
-            if (!windowSwitchListeners.isEmpty()) {
-                for (Window w : Window.getWindows()) {
-                    if (w.isShowing() && !Arrays.asList(w.getWindowListeners()).contains(getInstance())) {
-                        w.addWindowListener(getInstance());
-                    }
-                }
-            }
-        }
-
-        /**
-         * Unregister all listeners.
-         */
-        public static void teardown() {
-            for (Window w : Window.getWindows()) {
-                w.removeWindowListener(getInstance());
-            }
-        }
-
-        @Override
-        public void windowActivated(WindowEvent e) {
-            if (e.getOppositeWindow() == null) { // we come from a window of a different application
-                // fire WindowSwitchListeners
-                synchronized (Main.class) {
-                    Iterator<WeakReference<WindowSwitchListener>> it = windowSwitchListeners.iterator();
-                    while (it.hasNext()) {
-                        WeakReference<WindowSwitchListener> wr = it.next();
-                        WindowSwitchListener listener = wr.get();
-                        if (listener == null) {
-                            it.remove();
-                            continue;
-                        }
-                        listener.fromOtherApplication();
-                    }
-                }
-            }
-        }
-
-        @Override
-        public void windowDeactivated(WindowEvent e) {
-            // set up windows that have been created in the meantime
-            for (Window w : Window.getWindows()) {
-                if (!w.isShowing()) {
-                    w.removeWindowListener(getInstance());
-                } else {
-                    if (!Arrays.asList(w.getWindowListeners()).contains(getInstance())) {
-                        w.addWindowListener(getInstance());
-                    }
-                }
-            }
-            if (e.getOppositeWindow() == null) { // we go to a window of a different application
-                // fire WindowSwitchListeners
-                synchronized (Main.class) {
-                    Iterator<WeakReference<WindowSwitchListener>> it = windowSwitchListeners.iterator();
-                    while (it.hasNext()) {
-                        WeakReference<WindowSwitchListener> wr = it.next();
-                        WindowSwitchListener listener = wr.get();
-                        if (listener == null) {
-                            it.remove();
-                            continue;
-                        }
-                        listener.toOtherApplication();
-                    }
-                }
-            }
-        }
-    }
-
     /**
      * Registers a new {@code MapFrameListener} that will be notified of MapFrame changes.
Index: trunk/src/org/openstreetmap/josm/gui/MainApplication.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/MainApplication.java	(revision 11924)
+++ trunk/src/org/openstreetmap/josm/gui/MainApplication.java	(revision 11925)
@@ -363,6 +363,4 @@
         });
 
-        Main.MasterWindowListener.setup();
-
         boolean maximized = Main.pref.getBoolean("gui.maximized", false);
         if ((!args.hasOption(Option.NO_MAXIMIZE) && maximized) || args.hasOption(Option.MAXIMIZE)) {
Index: trunk/test/unit/org/openstreetmap/josm/MainTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/MainTest.java	(revision 11924)
+++ trunk/test/unit/org/openstreetmap/josm/MainTest.java	(revision 11925)
@@ -14,5 +14,4 @@
 import org.junit.Test;
 import org.openstreetmap.josm.Main.DownloadParamType;
-import org.openstreetmap.josm.Main.MasterWindowListener;
 import org.openstreetmap.josm.testutils.JOSMTestRules;
 
@@ -82,13 +81,3 @@
         assertNotNull(Main.toolbar);
     }
-
-    /**
-     * Unit test of {@link Main.MasterWindowListener}.
-     */
-    @Test
-    public void testMasterWindowListener() {
-        MasterWindowListener.setup();
-        MasterWindowListener.teardown();
-        assertNotNull(MasterWindowListener.getInstance());
-    }
 }
