On Ubuntu, using SWT to embed awt/swing code causes eclipse crash issues

Source: Internet
Author: User
Tags gtk


configuration : Ubuntu 13.04 + Eclipse4.3 + JRE 7

Symptom : Open an Eclipse view with an inline awt/swing code, eclipse directly hangs out


cause : Both awt/swing and SWT use locks to protect their threads when accessing GTK. AWT uses the GTK lock, but SWT uses its own lock. When using SWT to access AWT, an error occurs.


workaround : Use the following code in the code that accesses AWT with SWT:

Uimanager.setlookandfeel (Uimanager.getsystemlookandfeelclassname ());

Modified to:

if (Platform.WS_GTK.equals (Platform.getws ())) {Uimanager.setlookandfeel ("Javax.swing.plaf.metal.MetalLookAndFeel      ");      } else {Uimanager.setlookandfeel (Uimanager.getsystemlookandfeelclassname ()); }


Reference: HTTPS://GITHUB.COM/NKAVIANI/CA.UBC.MAGIC.PARTITIONING.ANALYZER.PLUGIN.ECLIPSE/ISSUES/3

https://bugs.eclipse.org/bugs/show_bug.cgi?id=341799

This article is from the "winger" blog, make sure to keep this source http://imu2008.blog.51cto.com/3844842/1437307

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.