-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Table flashes in white on column moving when in dark theme #273
Comments
Can you please provide a snippet to reproduce the issue? |
@jose-vasco Have you made any progress? My open source project Portfolio Performance is a RCP Eclipse application. I not only experience this when moving the tables, but also when expanding or collapsing trees. See the video below. I am running: Eclipse 2024-12 = Eclipse 4.34 = SWT 3.128.0.v20241113-2009 Bildschirmaufnahme.2024-12-29.um.18.54.27.mp4This is how the tree is created (there are multiple trees within the application) @lshanmug I am aware that this is not a snippet. Any hints where to look? It does not happen in Eclipse itself (for example in the "Problem" pane when grouped by problem type). How are the trees created differently there? |
@lshanmug The problem starts to show when adding this line: treeViewer.getTree().setLinesVisible(true); I can confirm that the problem goes away in my e4 application when commenting out this line. Here is a simple example to reproduce the problem. It is based on the default E4 Application created by the wizard. I then activate the dark theme and add a tree viewer. Bildschirmaufnahme.2024-12-30.um.08.50.10.mp4Please ignore the "Workbench has not been created yet" errors. The reasons is that this example is using the default macOS dark theme which in turn uses a color provider not available for a pure E4 application. SamplePart (from the E4 Application)package com.example.e4.rcp.parts;
import java.util.Arrays;
import java.util.List;
import org.eclipse.e4.ui.di.Focus;
import org.eclipse.e4.ui.di.Persist;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.widgets.TextFactory;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import jakarta.annotation.PostConstruct;
import jakarta.inject.Inject;
public class SamplePart {
private TreeViewer treeViewer;
@Inject
private MPart part;
@PostConstruct
public void createComposite(Composite parent) {
parent.setLayout(new GridLayout(1, false));
TextFactory.newText(SWT.BORDER) //
.message("Enter text to mark part as dirty") //
.onModify(e -> part.setDirty(true)) //
.layoutData(new GridData(GridData.FILL_HORIZONTAL))//
.create(parent);
treeViewer = new TreeViewer(parent);
treeViewer.getTree().setLinesVisible(true);
treeViewer.setContentProvider(new TreeContentProvider());
treeViewer.setInput(new Node("Root", Arrays.asList( //
new Node("Item 1", Arrays.asList(new Node("Subitem 1", Arrays.asList()))), //
new Node("Item 2", Arrays.asList(new Node("Subitem 2", Arrays.asList()))), //
new Node("Item 3", Arrays.asList(new Node("Subitem 3", Arrays.asList()))), //
new Node("Item 4", Arrays.asList(new Node("Subitem 4", Arrays.asList()))), //
new Node("Item 5", Arrays.asList(new Node("Subitem 5", Arrays.asList()))))));
treeViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
}
@Focus
public void setFocus() {
treeViewer.getTree().setFocus();
}
@Persist
public void save() {
part.setDirty(false);
}
}
class Node {
private final String name;
private final List<Node> children;
public Node(String name, List<Node> children) {
this.name = name;
this.children = children;
}
public String getName() {
return name;
}
public List<Node> getChildren() {
return children;
}
public String toString() {
return name;
}
}
class TreeContentProvider implements ITreeContentProvider {
@Override
public boolean hasChildren(Object element) {
return !((Node) element).getChildren().isEmpty();
}
@Override
public Object getParent(Object element) {
return null;
}
@Override
public Object[] getElements(Object inputElement) {
return ((Node) inputElement).getChildren().toArray();
}
@Override
public Object[] getChildren(Object parentElement) {
return ((Node) parentElement).getChildren().toArray();
}
} plugin.xml with the dark theme<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
id="product"
point="org.eclipse.core.runtime.products">
<product
application="org.eclipse.e4.ui.workbench.swt.E4Application"
name="com.example.e4.rcp">
<property
name="cssTheme"
value="com.example.theme.dark">
</property>
</product>
</extension>
<extension
point="org.eclipse.e4.ui.css.swt.theme">
<theme
basestylesheeturi="css/dark_mac.css"
id="com.example.theme.dark"
label="Dark Theme"
os="macosx">
</theme>
</extension>
</plugin> dark_mac.css@import url("platform:/plugin/org.eclipse.ui.themes/css/e4-dark_mac.css"); |
Hide lines because SWT table and trees flash white when dragging columns and/or expanding/collapsing nodes. Issue: eclipse-platform/eclipse.platform.swt#273
Hide lines because SWT table and trees flash white when dragging columns and/or expanding/collapsing nodes. Issue: eclipse-platform/eclipse.platform.swt#273
Hello! We are experiencing the whole table flashing when one starts to move table columns on dark theme on macOS (latest SWT - though we had seen this behavior in previous versions too, - and at least from Big Sur on).
In order to reproduce this, one should set table columns of a TreeViewer as moveable, and make the app useSystemAppearance while having the macOS in dark theme. As soon as one grabs the header of a column to move it, the whole table will get its background set to white. It reverts to its original look at dropping the column in any place. Additionally, this seems not to happen in M1 machines.
The text was updated successfully, but these errors were encountered: