Search code examples
csseclipsegtk3stylinge4

Eclipse css styling: override layout SWT.HORIZONTALE?


I love to have a very compact theme for eclipse. It use to be simple with GTK2, but now with oxygen, I've more and more things that are broken and I'm trying to get an ok compact style with GTK3.

I read a lot of things on it and the main win was to just use "minwaita" theme. It helps a lot!

But I still have an horrible 16px width lost due to perspective swticher. I found it thanks to the "e4 spies" plugin and I even succesfully set some properties as can be seen on the following image:

enter image description here

So, the problem is the green part. And I see that it is due to some SWT property, as reported by e4 css spy on the element:

CSS Properties:
    eclipse-perspective-keyline-color: rgb(88, 88, 88);
    handle-image: none;
    color: rgb(255, 255, 255);
    background-color: rgb(0, 255, 0);

CSS Classes:
  MToolControl
  Draggable
  HIDEABLE
  SHOW_RESTORE_MENU

CSS ID:
  PerspectiveSwitcher

SWT Style Bits:
  SWT.LEFT_TO_RIGHT
  SWT.DOUBLE_BUFFERED

CSS Class Element:
  org.eclipse.e4.ui.css.swt.dom.CompositeElement

SWT Layout: RowLayout {type=SWT.HORIZONTAL marginLeft=8 marginTop=6 
          marginRight=8 marginBottom=4 spacing=3 wrap=true pack=true 
          fill=false justify=false}
Bounds: x=1877 y=190 h=154 w=43

I tried to override that last part with margin-left and/or padding-left, with value of 0 and -8px, on it, on parent, on children. Nothing seems to work.

So, does anybody know if it's possible, and if so how to override the SWT Layout marginLeft and margingRight properties ?


Solution

  • Looking at the Eclipse CSS element definitions 'padding' values are only available on CTabFolder.

    'margin-xxx' values can be set for any control but the Composite containing the control must be using GridLayout and a flag called CSSSWTConstants.MARGIN_WRAPPER_KEY must be set in the composite's data.

    Since the composite you are looking at seems to be using RowLayout the margins can't be set (unless you write your own property handler).

    Note: CSS element properties are defined using the org.eclipse.e4.ui.css.core.elementProvider extension point and are mostly in the org.eclipse.e4.ui.css.swt plugin. The 'margin-xxx' properties are dealt with by the org.eclipse.e4.ui.css.swt.properties.css2.CSSPropertyMarginSWTHandler class.