# This patch file was generated by NetBeans IDE # Following Index: paths are relative to: F:\Sources\MainTrunk # This patch can be applied using context Tools: Patch action on respective folder. # It uses platform neutral UTF-8 encoding and \n newlines. # Above lines and this line are ignored by the patching process. Index: autoupdate/src/org/netbeans/modules/autoupdate/Autoupdater.java *** F:\Sources\MainTrunk\autoupdate\src\org\netbeans\modules\autoupdate\Autoupdater.java Base (1.57) --- F:\Sources\MainTrunk\autoupdate\src\org\netbeans\modules\autoupdate\Autoupdater.java Locally Modified (Based On 1.57) *************** *** 19,26 **** package org.netbeans.modules.autoupdate; - import java.awt.event.WindowEvent; - import java.awt.event.WindowListener; import java.io.File; import java.lang.reflect.Method; import java.util.ArrayList; --- 19,24 ---- *************** *** 60,94 **** /** Installs autoupdate checker */ static void installUpdateChecker( final Runnable updateChecker ) { - // XXX probably not ideal but should work for now... if (! Boolean.getBoolean("netbeans.full.hack") && ! Boolean.getBoolean("netbeans.close")) { // NOI18N ! // Just wait for GUI to pop up, whatever... ! l = new WindowListener () { ! public void windowOpened(WindowEvent e) { doInstallUpdateChecker (updateChecker); } - public void windowClosing(WindowEvent e) {} - public void windowClosed(WindowEvent e) {} - public void windowIconified(WindowEvent e) {} - public void windowDeiconified(WindowEvent e) {} - public void windowActivated(WindowEvent e) {} - public void windowDeactivated(WindowEvent e) {} - }; - // WindowsAPI is required to be called from AWT thread only - SwingUtilities.invokeLater (new Runnable () { - public void run () { - WindowManager.getDefault ().getMainWindow ().addWindowListener (l); - } }); } } - private static WindowListener l; - private static void doInstallUpdateChecker (final Runnable updateChecker) { // bugfix #43655, postpone the connect to AU till the main window is opened RequestProcessor.getDefault().post(updateChecker, 5000); - WindowManager.getDefault ().getMainWindow ().removeWindowListener (l); } // Try to avoid referring directly to IDESettings. --- 58,80 ---- /** Installs autoupdate checker */ static void installUpdateChecker( final Runnable updateChecker ) { if (! Boolean.getBoolean("netbeans.full.hack") && ! Boolean.getBoolean("netbeans.close")) { // NOI18N ! // install update checker when UI is ready (main window shown) ! WindowManager.getDefault().invokeWhenUIReady(new Runnable () { ! public void run () { ! System.out.println("autoupdater called OK"); doInstallUpdateChecker (updateChecker); } }); } } private static void doInstallUpdateChecker (final Runnable updateChecker) { // bugfix #43655, postpone the connect to AU till the main window is opened RequestProcessor.getDefault().post(updateChecker, 5000); } Index: core/windows/src/org/netbeans/core/windows/WindowManagerImpl.java *** F:\Sources\MainTrunk\core\windows\src\org\netbeans\core\windows\WindowManagerImpl.java Base (1.44) --- F:\Sources\MainTrunk\core\windows\src\org\netbeans\core\windows\WindowManagerImpl.java Locally Modified (Based On 1.44) *************** *** 19,24 **** --- 19,25 ---- package org.netbeans.core.windows; + import java.util.ArrayList; import java.awt.*; import java.beans.*; *************** *** 77,82 **** --- 78,85 ---- private TopComponent persistenceShowingTC; + /** exclusive invocation of runnables */ + private Exclusive exclusive = new Exclusive(); /** Default constructor. Don't use directly, use getDefault() * instead. */ *************** *** 708,713 **** --- 711,717 ---- /** Sets visible or invisible window system GUI. */ public void setVisible(boolean visible) { + SwingUtilities.invokeLater(exclusive); central.setVisible(visible); } *************** *** 1123,1128 **** --- 1127,1180 ---- return PersistenceManager.getDefault().getGlobalTopComponentID(tc, preferredID); } + /** + * {@inheritDoc} + */ + @Override + public void invokeWhenUIReady(Runnable run) { + exclusive.register(run); + } + + /** Handles exclusive invocation of Runnables. + */ + private static final class Exclusive implements Runnable { + /** lists of runnables to run */ + private ArrayList arr = new ArrayList(); + + /** Registers given runnable and ensures that it is run when UI + * of the system is ready. + */ + public synchronized void register(Runnable r) { + arr.add(r); + SwingUtilities.invokeLater(this); + } + + public void run() { + if (!WindowManagerImpl.getInstance().isVisible()) { + return; + } + + ArrayList arrCopy = null; + synchronized (this) { + if (arr.isEmpty()) { + return; + } + + arrCopy = arr; + arr = new ArrayList(); + } + + for (Runnable r : arrCopy) { + try { + r.run(); + } catch (RuntimeException ex) { + Logger.getLogger(WindowManagerImpl.class.getName()).log( + Level.WARNING, null, ex); + } + } + } + } // end of Exclusive class + public void resetModel() { central.resetModel(); RegistryImpl rimpl = (RegistryImpl)componentRegistry(); Index: openide/windows/test/cfg-unit.xml *** F:\Sources\MainTrunk\openide\windows\test\cfg-unit.xml Base (1.2) --- F:\Sources\MainTrunk\openide\windows\test\cfg-unit.xml Locally Modified (Based On 1.2) *************** *** 1,6 **** --- 1,40 ---- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +