19.09.2010, 17:10
(19.09.2010, 11:43)routeconverter Wrote: I understand the connection between the Thread.sleep() and the file dialog as the following:
- in Mac OS X the first thread of a process does the event processing
- for Java, it seems the Apple engineers managed to connect this directly to the AWT-EventQueue thread which is the single Java thread used to update the user interface for pure Java apps -XstartOnFirstThread is not necessary
- for the browser, I'm using a library (DJNativeSwingSWT) that allows to embed Eclipse SWT components into Javas Swing UI framework
- Eclipse SWT consists of native code and Java wrappers (where Java Swing is pure Java)
- this means the event processing becomes a problem since events from the operating system must reach the native code components i.e. the browser and the pure Java Swing (via the native Java VM)
- -XstartOnFirstThread and the Java class chrriis.dj.nativeswing.swtimpl.NativeInterface help to make sure that this hybrid SWT/Swing setup works
- if you now open the file dialog and after several layers of abstract at some point the Java VM calls the Mac OS to open a window that seems to collide with the Java thread I've throttled with Thread.sleep() which tries to call the native browser component
- I guess the reason for this collision is the single threaded approach of either Mac OS communicating with the apps its running or the Java VM executing AWT/Swing apps
Does this sound reasonable?
I read it 4-5 times and it sounds logical, but I miss the background knowledge on how MacOSX and java interact to be able to judge the validity of your arguments.
However, I googled around a bit and I found this article (homepage.mac.com/svc/macosxjava.pdf) which mentions in section 3.4 to use awt instead of swing for file dialogs. It is terribly old (2001) and I can't judge the correctness of this or whether it is still valid.
If your arguments are correct, it might be that the awt file dialogs might work correctly (or not?)
If I search the code I can see that you use the "javax.swing.FileChooser" function, but I don't know if I can change it easily to experiment with the awt dialog.
(19.09.2010, 11:43)routeconverter Wrote: remove all the webBrowser.runInSequence( .. ) <snip>Well, it does, but not with the desired effect. It seems to make everything slower without fixing the popup issue.
blocks become
Quote: webBrowser.executeJavascript(script);
Does this show any effect?
(19.09.2010, 11:43)routeconverter Wrote:Sorry. A copy&paste error. It should be (http://nadeausoftware.com/articles/2009/...ecorations). I just copied it in as "background info" as it is related to the other discussion.(19.09.2010, 10:19)hvdwolf Wrote: BTW: I stumbled upon this article (http://nadeausoftware.com/node/90).
I don't understand why you're citing this. What is special about that page?
