Thursday, November 3, 2016

EclipseCon Europe 2016

EclipseCon Europe this year was a really nice event (as always). Here is my brief report from it. I would not cover talks I went to in details as one should be able to watch them online eventually
First of all we had the first Eclipse Platform summit (at least that I know of) with 15-20 attendees. There is the perception that Platform started to improve in terms of new features and openness to the community but there are certain parts that are not there yet so actions are needed there. Biggest pain point expressed was blocking UI and there was some interest towards reducing the dialogs and/or making them non-blocking. Willingness to merge projects was raised but it's not a viable short term solution although it might be good as long term goal. Notifications both in terms of system wide and in-workbench came few times and prototyping SWT support is something we should find time for during Oxygen timeframe. Also Platform is supposed to lead by example and help projects on top of it to adhere to best practices was agreed on but this would require significant time investment in order to get the codebase and UX to that state.
VSCode keynote - quite interesting especially with the mentioning of some debugging protocol they have (similar to the language server). Once language servers and Eclipse intergration catch up going to standardize the debugging should make adding new language support way more straightforward.
I had the honor to present "Full CSS styling for SWT and Eclipse" talk - around 20 people in the room (the room wasn't much bigger). It was well received with few comments at the end that people were sceptical in the beginning but it looked promising to them at the end (a noteworthy person changed his opinion from "crazy idea" to "interesting idea"). The idea of using SWT/GTK on Win32 was received way better than I expected - with one guy joined the bug to build himself and hopefully help with further work. It really pleased my ear to hear from few people (that I didn't knew before that) during the conference that they moved towards Linux due to the way better experience they had on GTK/Linux than on Win32.
It was a pleasure to see so many Red Hatters and here about the contributions done by the company in almost every talk I went to or participated including a special place for that in the members meeting. Let's hope that next year our contributions will be even bigger but many other companies would have done their part too.

Wednesday, September 7, 2016

Runtime CSS styling for SWT



In the previous post it was explained how one can do global styling of SWT components in your application via CSS prior.
But that's only the surface, all these capabilities can be used for runtime styling of individual component.  NOTE: Eclipse Oxygen I20160906-0800 or newer on GTK3 required.
Styling individual component that way is even simpler than the traditional SWT API especially if you consider that to achieve some of the capabilities exposed one has to do custom drawing with all its verbosity and potential problems.
Enough words - the magic is in Widget.setData(String, Object) method and the secret key org.eclipse.swt.internal.gtk.css . All you have to do is call yourWidget.setData("org.eclipse.swt.internal.gtk.css", yourCSS);  with proper GTK 3.20+ CSS (note: this is labeled as API by GTK guys thus old versions are not accepted).
The amount of properties supported is pretty wide and ever growing. At least for my limited CSS knowledge most of the things I tried just worked.
Time for screencasts:


 I'm really enthusiastic about the future, hopefully you will be too after watching the videos and trying it yourself !

Tuesday, August 30, 2016

Advanced and fast CSS styling for SWT

The strongest (or the weakest - depends of your angle) part of SWT is its deep system integration. But this means you get the Look'n'Feel of your system UI toolkit and any deviation from it (e.g. e4 theme engine) is either too limited or too slow or both.
On the other side if the underlying UI toolkit provides really advanced and declarative styling capabilities (like GTK+ does) making use of them from SWT is not hard at all. And we already start to use it extensively (to adjust tabs sizes, provide key bindings for tree expand/collapse) and usage will only increase over time. Best part of it is that it really works at the GTK level thus there is almost no performance penalty for sane operation (going wild with gradients and etc. will have a penalty of course) . Actually it's providing a custom GTK theme for you application allowing GTK to do all its caching and other optimizations . Something one can never achieve with custom drawing
But this would never be enough - there are just too many different themes used, everyone has his own personal preferences about amount of white space around widgets and etc. So best thing we can do from SWT side is provide sane defaults for everyone and open the door for the heavy opinionated people to tweak their Eclipse UI as much as GTK+ allows them.
Support for that is in master already. Download latest Oxygen nightly build (N20160829-2000 or newer), create your own css file (GTK+ docs explain things pretty well) and edit your eclipse.ini file to point to it by adding a line like -Dorg.eclipse.swt.internal.gtk.cssFile=/path/to/my.css in the -vmargs section and enjoy.
As a small example I created a really visually distinguishing style like:

button  {
    border-width: 1px;
    border-radius: 30px;

    background-image: -gtk-gradient (linear,
             left top,
             left bottom,
             color-stop(0.0,rgba(34,97,170,1)),
             color-stop(0.50,rgba(56,145,218,1)),
             color-stop(0.51,rgba(34,131,216,1)),
             color-stop(1.00,rgba(134,191,234,1)));
}
button:hover {
  box-shadow: inset 0 0 0 5px #3071A9;
}

to achieve this funky colors and hover effect.


This is just dummy example but at least there is the ability to tweak and make Eclipse match your personal preferences.

NOTE: The ability to point to your css file is only exposed on systems having GTK+ version 3.20 or newer as this is the first GTK version that has specified and thus stabilized the syntax to a state exposable to users.
NOTE 2: If there is anyone with experience in Win32 and/or Cocoa UI toolkits knowing if they provide such capabilities and how they can be exposed  please contact me as it would be nice to have such feature exposed for every SWT user not just for those on GTK. In order for this to happen we need people with deep knowledge and vested interest in these other UI toolkits.