Search code examples
eclipseubuntugtkeclipse-rcpmessagebox

Eclipse RCP MessageBox.open don't work on Ubuntu 11.10


as the title says, when I when i call the method open of a MessageBox instance, nothing happens. This is the code:

Shell dialog = new Shell(SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL | SWT.ON_TOP);
shell.open();

In this dialog some actions let me open this message box:

MessageBox box = new MessageBox(dialog, SWT.ICON_WARNING | SWT.OK);
box.setText("Warning");
box.setMessage(label);
box.open();

I'm using Eclipse Indigo 3.7.2 for RCP and RAP Developers on Ubuntu 11.10 with Unity (Ubuntu2D) and Compiz 0.9.6, with OpenJDK 1.7.0_147. Here and here are some tips to solve this problem, (fixed by setting the environment variable GDK_NATIVE_WINDOWS), but nothing works.


Solution

  • Ok, I solved it. For some reasons, under Linux the message boxes are drawn under the components created with the flag SWT.ON_TOP (under Windows the messages boxes are always above any component). I just removed the SWT.ON_TOP from the parent dialog and everything works.