How to open modal Swing dialog from Eclipse [message #462245] |
Sun, 09 October 2005 13:59 |
Eclipse User |
|
|
|
Originally posted by: hans_martin_.gmx.de
I am developing an Eclipse plugin using some Swing classes. What is the
correct way of opening Swing dialogs from SWT? From an
org.eclipse.jface.action.Action I can open the dialog without problems
using SwingUtilities.invokeLater(...) where the dialog is opened in the
Runnable, but the resulting dialog is not modal.
I guess I haven't fully understood the event handling - are there any
online documents explaining the AWT-SWT threading issues?
Any help appreciated
Hans
|
|
|
|
Re: How to open modal Swing dialog from Eclipse [message #462253 is a reply to message #462251] |
Sun, 09 October 2005 21:41 |
Eclipse User |
|
|
|
Originally posted by: hans_martin_.gmx.de
> Open swt dialog and put swing control in
I thought about this as well, but is this the only way? The pure Swing
dialog shows up nicely and it would be quite an overhead if I had to
reimplement control logic for close, ok etc. Furthermore I would need to
change the dialog launching code everywhere in the Swing code.
Also, assuming I do this, how can I then ensure that the Swing thread
"waits" until the SWT dialog is closed?
Thanks for any clarification
Hans
|
|
|
|
|
Re: How to open modal Swing dialog from Eclipse [message #462376 is a reply to message #462329] |
Tue, 11 October 2005 15:16 |
Eclipse User |
|
|
|
Originally posted by: hans_martin_.gmx.de
Daniel Spiewak wrote:
> You do have a second option which is to use the SWT_AWT.getFrame(Composite)
method. This will return an instance of Frame which you can then use to
parent your dialog. AFAIK, it should be modal after that.
This is essentially what I am doing now, but the dialog is not modal.
getFrame would just return the WEmbeddedFrame which I also get by asking
any nested Swing component for its top level ancester. Since the embedded
frame is part of the overall Eclipse Shell, the Shell is not blocked.
> You can wrap an SWT Shell around your existing dialog, and SWT will provide
all the functionality of the Swing version. However, I do agree that it's a
major overhead (not to mention maintenance problem) to do so.
Unless someone else has some good ideas, I really have to wrap all Swing
dialogs with SWT Shells :( I would consider this a serious flaw in the
SWT_AWT class.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03612 seconds