Search code examples
eclipse-rcpe4eclipse-pde

.MPart does not affect in CSS


I tried following CSS if there is effect of color but I could not change the default white color of the Part.

.MPartStack { 
swt-maximize-visible: false;
swt-minimize-visible: false; 
swt-mru-visible: true; 
swt-tab-outline: false;
}

.MPart {
background-color: black;
border-color: black;
swt-corner-radius: 0;
}

Only Part Stack works and I am unable to see any change reflected from .MPart.


Solution

  • If you create a Composite in the code for your part to need to set it to inherit the background using

    composite.setBackgroundMode(SWT.INHERIT_DEFAULT);
    

    otherwise the part Composite will not pick up the MPart style.

    An alternative is to set a CSS class for the controls that you create, like this:

    WidgetElement.setCSSClass(control, "your-class-name");