Community
Participate
Working Groups
Summary: Swing hangs eclipse when embedded within a MultiPageEditorPart and the editor is used, and then closed. Build: Stable build 20020125 Details: There are two pages within the editor. One is just a SWT control within a composite. The other page is embedded swing controls. I've created an AWT Panel using SWT_AWT.new_Panel , added a JLayeredPane to the Panel, and then added three JButtons to the JLayeredPane. The code to do this is here: protected void createSwingPage(){ Composite composite = new Composite(getContainer(), SWT.NONE); final Display display = Display.getCurrent(); Panel awtPanel = SWT_AWT.new_Panel(composite); awtPanel.setLayout(new BorderLayout()); JLayeredPane layeredPane = new JLayeredPane(); layeredPane.setLayout(new FlowLayout()); awtPanel.add(layeredPane); final JButton jbutton = new JButton("Test"); jbutton.addActionListener(new ActionListener () { public void actionPerformed (ActionEvent event) { display.asyncExec(new Runnable () { public void run () { SwingUtilities.invokeLater(new Runnable(){ public void run(){ jbutton.setText ("Swing Button Selected"); } }); } }); } }); layeredPane.add(jbutton); layeredPane.add(new JButton("test2")); layeredPane.add(new JButton("test3")); int index = addPage(composite); setPageText(index, "Swing"); } This is the behavior I've noticed. 1. If the editor is launched, and then closed immediately, there is no problem 2. If the editor is launched, and then a swing event is executed (click on a button), and then the editor is closed, eclipse hangs 3. If the editor is lauched, a swing event is executed (click on a button), then another tab of the MultiPageEditorPart is clicked on, and then the editor is closed, there is no problem. All the other tests I have done are basically permutations of this. Things like changing the perspective, have the same effect as clicking on the tab, but things like selecting a menu item do not. It appears that if an SWT event is fired which either changes the focus or visibility of the swing controls after a Swing event has been fired there is no problem. Anything else seems to hang eclipse. I've also done some looking at the dispose events, and apparently the behavior happens after the dispose event of the Composite object, but prior to the dispose of the editor itself. Please note, this behavior happens when the editor is disposed, and it doesn't matter if it is due to eclipse being closed, or just the editor. The problem happens reguardless. I haven't tested this on different windows platforms, but have tested it on different machines, with the same results. I also noticed that one of the examples provided in the newsgroups which details how to embed swing within SWT had the same problems on my machine when run from within a eclipse debug session. I haven't tested it on another machine or outside an eclipse debug session.
Later.
Post 2.0. Re-opening bug reports for review.
Here is a message I got from Leonard Norrgard [lkn@acm.org] about this: "I started looking into this today. It seems to be the same bug I saw myself with OTI's SWT_AWT code. My EmbeddedSwing solution doesn't have this problem. I will however continue to look into your example code tomorrow - I'm condensing it to a simple-as-possible standalone SWT application so that I can then change that code to be based on the EmbeddedSwing component."
How quick a year passes -- I sent that email to David on 20th February, 2002. The solution still exists. I guess I should revive the efforts to get it published. Nothing has happened since the end of October on getting it published, because I haven't set aside time for it.
Does this still happen?
No, this is fixed in latest.