SWT

5 posts

Eclipse theme after Linux Mint Upgrade

A while ago I wrote about a theming issue with Linux Mint and Eclipse. It took a while longer than expected, but the change finally made it into Linux Mint in version 17.1.

However, starting with Linux Mint 17, there seems to be a new issue. Not that dramatic like the old one, but still somewhat annoying. The default Linux Mint theme (Mint-X) chooses a light gray base color value as a background. This might look nice in most applications, however the mixture of Eclipses (E4) recent approach to create its own theming over the operating system, somewhat collides with that.

Text editors and the tree view inherit a light gray background from the operating system theme, while other Eclipse background elements stay white.

There seems to be a simple fix for that however. Edit the file /usr/share/themes/Mint-X/gtk-2.0/gtkrc and change the first real line from:

[code]gtk_color_scheme = "bg_color:#d6d6d6\nselected_bg_color:#9ab87c\nbase_color:#F7F7F7" # Background, base.[/code]

to:

[code]gtk_color_scheme = "bg_color:#d6d6d6\nselected_bg_color:#9ab87c\nbase_color:#FFFFFF" # Background, base.[/code]

However, and that is why I stumbled over this after the upgrade to Mint 17.1, this change will be overridden after an upgrade of the theme package. This never happened one in version 17, but you never know.

Note: It is also interesting that Eclipse/SWT seems to use GTK 2 instead of GTK 3. If you have some information in that, please drop me a line!

Fixing the Mint-X theme for Eclipse/SWT

If you are running Mint, Eclipse and you like the Mint-X theme, you might be a bit frustrated every time you open up Eclipse. Especially with Eclipse 4.2 the design of the toolbars is pretty messed up. See the launchpad bug entry: https://bugs.launchpad.net/linuxmint/+bug/1168281

eclipse1

Gladly this is only a minor glitch which can be fixed easily. Hopefully the change of the github pull request will find its way into Mint.

Access to WMI in Java using Eclipse SWT OLE integration

Today I ran into a problem which could easily solved using a short WMI query. The problem was that the query must be executed within a Java UI application. Googling for a solution I came only up with either quite some ugly workarounds (like generating a VBScript fragment, forking off the VBScript runtime and parsing the result) or some full blown COM/DCOM interfaces (like J-Integra or J-Interop). Although I really like J-Interop (we are using it for DCOM when accessing OPC server in OpenSCADA Utgard) it has some drawbacks. For J-Interop every access (even local access) is a network based access. Since J-Interop only supports DCOM it is free of any platform specific code but required the machine to be accessible using “remoting” functionality (DCOM). Since I wanted to query the WMI from a UI application and I am sure that the WMI query will stay on the Win32 version of the application I was not keen on adding “remoting” as a requirement to the UI application.

After some digging I remembered that SWT brings an OLE interface which provides direct COM access. So I started poking around and finally come up with a solution that works quite well.

For the impatient: The full source code is available from github https://github.com/ctron/wmisample and the screenshot is here.

Continue reading

Combo viewer requirements

Today I tried to create a combo viewer in Eclipse with a different approach than the it seems the widgets was designed. I have an object which has to main properties an ID and a descriptive name. While this is nothing unusual following requirements seems to be:

The list of the combo box should show the label while the text input field of the combo box should show the id of the object. Using Eclipse Databinding this seems to be an impossible task (if you know a way please post it at stackoverflow). Continue reading