Bug 579468

Summary: [CSS] Request: Add support for more dynamic CSS styles and attributes for Tree (TreeItems)
Product: [Eclipse Project] Platform Reporter: Wiebke Timm <wiebke.timm>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: emera, Lars.Vogel, sravankumarl
Version: 4.24   
Target Milestone: ---   
Hardware: PC   
OS: Windows 10   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=577493
https://bugs.eclipse.org/bugs/show_bug.cgi?id=579470
Whiteboard:

Description Wiebke Timm CLA 2022-03-29 07:24:17 EDT
For styling eclipse SWT clients with our corporate design, we need an extension of the dynamic Button CSS functionality.


Please support these states for TreeItems in Tree widgets:

normal
selected
hover
pressed
disabled (not dynamic yet)


And these attributes:

color, 
background-color
border-color *
corner-radius *

* these are nice to have but not currently a use case for us


See corresponding ticket for buttons:
See https://bugs.eclipse.org/bugs/show_bug.cgi?id=577493
Comment 1 Wiebke Timm CLA 2022-03-29 07:26:38 EDT
The first sentence must be (I can't edit the description):

For styling eclipse SWT clients with our corporate design, we need an extension of the dynamic CSS functionality for TreeItems.
Comment 2 Sravan Kumar Lakkimsetti CLA 2022-03-29 22:56:29 EDT
SWT has been moved to github. Please open as issue in https://github.com/eclipse-platform/eclipse.platform.swt
Comment 3 Lars Vogel CLA 2022-03-30 04:37:30 EDT
Wiebke, I would recommend using NatTable here which is fully stylable and supports CSS. I mark this one as wontfix. In general Nattable is the better table implementation.


If you still have a need for this one, we can open a new ticket at Github.
Comment 4 Lars Vogel CLA 2022-03-30 04:38:03 EDT
(In reply to Lars Vogel from comment #3)
> Wiebke, I would recommend using NatTable here which is fully stylable and
> supports CSS. I mark this one as wontfix. In general Nattable is the better
> table implementation.
> 
> 
> If you still have a need for this one, we can open a new ticket at Github.

Better tree implementation. Despite the name NatTable supports also trees.
Comment 5 Wiebke Timm CLA 2022-03-31 03:02:07 EDT
Replacing Tree with NatTable is not possible when using third-party components or older (released) components in your code.
Comment 6 Edit Mihancea CLA 2022-07-12 09:38:52 EDT
Thank you for the tip to use NatTable. We could rewrite our Tables and Trees using NatTable, the only problem is we cannot style the the contained Tree items in the Properties view provided by Eclipse.
And that prevents us from obtaining a more uniform look for our product.

Even though the TreeItem is not a custom widget, I followed the steps described in https://www.vogella.com/tutorials/Eclipse4CSS/article.html#css-support-for-custom-widgets
to add the 2 extensions (elementProvider and propertyHandler) for the TreeItem and the background-color property.
Then added TreeItem {background-color: ...} in the theme css.
Unfortunately it does not seem to work, if I set a breakpoint in my elementProvider class, it is hit and the adapter for the TreeItem is created.
The breakpoints in the implementation of the propertyHandler extension are never hit.
Should this work for any existing swt Widgets and I'm probably making a mistake somewhere?

Also noticed that the TreeItems are not visible when inspecting with the Css Spy, only the parent Tree can be inspected. 
Not sure if it has anything to do with the fact that we are not able to style them.