开发者

How does one debug the processing of a JComboBox's actionEvent in Eclipse and avoid locking up the windowing system?

开发者 https://www.devze.com 2023-03-06 03:38 出处:网络
I have written an Eclipse plugin that has a Swing GUI.To debug the plugin, I spawn a secondary Eclipse workspace.I then set a breakpoint on a method that gets called by an actionPerformed method when

I have written an Eclipse plugin that has a Swing GUI. To debug the plugin, I spawn a secondary Eclipse workspace. I then set a breakpoint on a method that gets called by an actionPerformed method when a menu item is chosen from a JComboBox.

When I choose an item from the JComboBox, my GUI freezes with the entire JComboBox's menu shown. The KDE icon representing the Eclipse debugging worksp开发者_高级运维ace flashes as it usually does when a breakpoint is hit. Unfortunately, at this point, my KDE session is hosed. I can move my mouse about, but selecting any window or icon has no effect (including the flashing Eclipse debugging icon). I can't do anything in KDE, so I go to a regular terminal window via and kill off the eclipse process. This enables me to do things in KDE again.

What can I do to avoid this lockup in KDE 4.5.5 and debug my code? Here are some of the relevant Java and Eclipse properties:

eclipse.buildId=M20100909-0800
eclipse.commands=-os
linux
-ws
gtk
-arch
x86
-showsplash
/am/embassy/vol/x6/eclipse/eclipse-jee-helios-SR1//plugins/org.eclipse.platform_3.6.1.v201009090800/splash.bmp
-launcher
/am/embassy/vol/x6/eclipse/eclipse-jee-helios-SR1/eclipse
-name
Eclipse
--launcher.library
/am/embassy/vol/x6/eclipse/eclipse-jee-helios-SR1//plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.1.R36x_v20100810/eclipse_1309.so
-startup
/am/embassy/vol/x6/eclipse/eclipse-jee-helios-SR1//plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar
-product
org.eclipse.epp.package.jee.product
-clean
-debug
-vm
/usr/pkg/java/sun-6/bin/../lib/i386/client/libjvm.so
java.awt.graphicsenv=sun.awt.X11GraphicsEnvironment
java.awt.printerjob=sun.print.PSPrinterJob
java.class.path=/am/embassy/vol/x6/eclipse/eclipse-jee-helios-SR1//plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar
java.class.version=50.0
java.endorsed.dirs=/usr/pkg/java/sun-6/lib/endorsed
java.ext.dirs=/usr/pkg/java/sun-6/lib/ext:/usr/java/packages/lib/ext
java.home=/usr/pkg/java/sun-6
java.library.path=/usr/pkg/java/sun-6/lib/i386/client:/usr/pkg/java/sun-6/lib/i386:/usr/pkg/lib:::/usr/java/packages/lib/i386:/lib:/usr/lib
java.runtime.name=Java(TM) SE Runtime Environment
java.runtime.version=1.6.0_22-b04
java.specification.name=Java Platform API Specification
java.specification.vendor=Sun Microsystems Inc.
java.specification.version=1.6
java.vendor=Sun Microsystems Inc.
java.version=1.6.0_22
java.vm.info=mixed mode, sharing
java.vm.name=Java HotSpot(TM) Client VM
java.vm.specification.name=Java Virtual Machine Specification
java.vm.specification.vendor=Sun Microsystems Inc.
java.vm.specification.version=1.0
java.vm.vendor=Sun Microsystems Inc.
java.vm.version=17.1-b03


As described here: http://bugs.sun.com/view_bug.do?bug_id=6714678, the workaround is disabling acquiring grabs on X11 platform by adding: -Dsun.awt.disablegrab=true to VM arguments.


I had neglected to wrap the processing of the ActionEvent with SwingUtilities.invokeLater(). Once I did so, my problem was solved.

0

精彩评论

暂无评论...
验证码 换一张
取 消