Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wolf2022-02-07 15:47:41 +0000
committerThomas Wolf2022-02-07 16:03:22 +0000
commit6f925c81d59b9caa35dc8b523907f135f55ab9cf (patch)
treec924bd71425dda49b95b15536ef48a2e3d646d55
parent4a115a2646ecb562761aa53aeca7d2ca591eb7a3 (diff)
downloadegit-6f925c81d59b9caa35dc8b523907f135f55ab9cf.tar.gz
egit-6f925c81d59b9caa35dc8b523907f135f55ab9cf.tar.xz
egit-6f925c81d59b9caa35dc8b523907f135f55ab9cf.zip
[dark mode] Use default background for tables and trees
Use the default background #2F2F2F instead of the somewhat lighter background the default Eclipse dark theme assigns to tables and trees. The trees in other viewers also use this background; there is no reason to use a lighter shade of gray. With this change, all elements in the git history and git staging views use the same background, and it's the same background as is used in other views. Bug: 578611 Change-Id: Ic69c8c590d0cf78d46eaaed13e62b55ae8b9309f Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
-rw-r--r--org.eclipse.egit.ui/css/e4-dark_egit_prefstyle.css20
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIUtils.java6
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitAndDiffComponent.java7
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FindToolbar.java7
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java6
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java3
6 files changed, 39 insertions, 10 deletions
diff --git a/org.eclipse.egit.ui/css/e4-dark_egit_prefstyle.css b/org.eclipse.egit.ui/css/e4-dark_egit_prefstyle.css
index 520c283b97..024ad6c1d9 100644
--- a/org.eclipse.egit.ui/css/e4-dark_egit_prefstyle.css
+++ b/org.eclipse.egit.ui/css/e4-dark_egit_prefstyle.css
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014, 2015 Andrea Guarinoni and others.
+ * Copyright (c) 2014, 2022 Andrea Guarinoni and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -40,4 +40,20 @@ IEclipsePreferences#org-eclipse-ui-workbench:org-eclipse-egit-ui {
.MPart Composite > StyledText.org-eclipse-egit-ui-CommitAndDiffComponent {
background-color: inherit;
color: inherit;
-} \ No newline at end of file
+}
+
+/*
+ * Use a darker background for the tables in the Git history page. The default dark theme assigns
+ * a slightly lighter background otherwise; we want the default background color as is used for
+ * other views (#2F2F2F; decimal 47,47,47).
+ */
+Table.org-eclipse-egit-ui-GitHistoryPage {
+ background-color: inherit;
+}
+
+/*
+ * Same for the staged/unstaged tree viewers in the staging view.
+ */
+.MPart Section Tree.org-eclipse-egit-ui-StagingView {
+ background-color: inherit;
+}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIUtils.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIUtils.java
index 2d74fb8ac1..e31cead753 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIUtils.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIUtils.java
@@ -107,6 +107,12 @@ import org.eclipse.ui.services.IServiceLocator;
*/
public class UIUtils {
+ /**
+ * Key to use for {@link Control#setData(String, Object)} to set a CSS class
+ * on an SWT element.
+ */
+ public static final String CSS_CLASS_KEY = "org.eclipse.e4.ui.css.CssClassName"; //$NON-NLS-1$
+
/** Default image descriptor for files */
public static final ImageDescriptor DEFAULT_FILE_IMG = PlatformUI
.getWorkbench().getSharedImages()
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitAndDiffComponent.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitAndDiffComponent.java
index b4a91c6030..e33825c795 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitAndDiffComponent.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitAndDiffComponent.java
@@ -14,6 +14,7 @@ import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.eclipse.egit.ui.UIUtils;
import org.eclipse.egit.ui.internal.ActionUtils;
import org.eclipse.egit.ui.internal.commit.DiffViewer;
import org.eclipse.egit.ui.internal.dialogs.HyperlinkSourceViewer;
@@ -62,8 +63,6 @@ import org.eclipse.ui.editors.text.EditorsUI;
*/
public class CommitAndDiffComponent {
- private static final String CSS_CLASS_KEY = "org.eclipse.e4.ui.css.CssClassName"; //$NON-NLS-1$
-
private static final String CSS_CLASS = "org-eclipse-egit-ui-CommitAndDiffComponent"; //$NON-NLS-1$
private ScrolledComposite commentAndDiffScrolledComposite;
@@ -332,8 +331,8 @@ public class CommitAndDiffComponent {
}
});
- commentWidget.setData(CSS_CLASS_KEY, CSS_CLASS);
- diffWidget.setData(CSS_CLASS_KEY, CSS_CLASS);
+ commentWidget.setData(UIUtils.CSS_CLASS_KEY, CSS_CLASS);
+ diffWidget.setData(UIUtils.CSS_CLASS_KEY, CSS_CLASS);
}
/**
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FindToolbar.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FindToolbar.java
index 283e94849b..29a2a8ad54 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FindToolbar.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FindToolbar.java
@@ -26,6 +26,7 @@ import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.UIPreferences;
+import org.eclipse.egit.ui.UIUtils;
import org.eclipse.egit.ui.internal.UIIcons;
import org.eclipse.egit.ui.internal.UIText;
import org.eclipse.jface.action.Action;
@@ -91,8 +92,6 @@ public class FindToolbar extends Composite {
public void setMessage(FindToolbar originator, String text);
}
- private static final String CCS_CLASS_KEY = "org.eclipse.e4.ui.css.CssClassName"; //$NON-NLS-1$
-
private static final String NO_RESULTS_CLASS = "org-eclipse-egit-ui-FindToolbar-noResults"; //$NON-NLS-1$
/**
* Preference value for searching all the fields
@@ -407,7 +406,7 @@ public class FindToolbar extends Composite {
}
private void setNotFoundBackgroundColor() {
- patternField.setData(CCS_CLASS_KEY, NO_RESULTS_CLASS);
+ patternField.setData(UIUtils.CSS_CLASS_KEY, NO_RESULTS_CLASS);
patternField.reskin(SWT.ALL);
noResults = true;
}
@@ -415,7 +414,7 @@ public class FindToolbar extends Composite {
private void setNormalBackgroundColor() {
if (noResults) {
Color currentColor = patternField.getBackground();
- patternField.setData(CCS_CLASS_KEY, null);
+ patternField.setData(UIUtils.CSS_CLASS_KEY, null);
patternField.reskin(SWT.ALL);
if (currentColor.equals(patternField.getBackground())) {
// If the theme has no definition for the text field's
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java
index dff6aace30..70988ed8a9 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java
@@ -184,6 +184,8 @@ import org.eclipse.ui.texteditor.IUpdate;
public class GitHistoryPage extends HistoryPage implements RefsChangedListener,
TableLoader, IShowInSource, IShowInTargetList {
+ private static final String CSS_CLASS = "org-eclipse-egit-ui-GitHistoryPage"; //$NON-NLS-1$
+
private static final String TEAM_UI_PLUGIN_ID = "org.eclipse.team.ui"; //$NON-NLS-1$
private static final String TEAM_UI_LINKING_PREFERENCE = "pref_generichistory_view_linking"; //$NON-NLS-1$
@@ -1453,6 +1455,8 @@ public class GitHistoryPage extends HistoryPage implements RefsChangedListener,
graph = new CommitGraphTable(graphDetailSplit, getSite(), popupMgr,
this, resources);
+ graph.getTable().setData(UIUtils.CSS_CLASS_KEY, CSS_CLASS);
+
Activator.getDefault().getPreferenceStore()
.addPropertyChangeListener(listener);
@@ -1479,6 +1483,8 @@ public class GitHistoryPage extends HistoryPage implements RefsChangedListener,
}
});
+ fileViewer.getControl().setData(UIUtils.CSS_CLASS_KEY, CSS_CLASS);
+
layoutSashForm(graphDetailSplit,
UIPreferences.RESOURCEHISTORY_GRAPH_SPLIT);
layoutSashForm(revInfoSplit, UIPreferences.RESOURCEHISTORY_REV_SPLIT);
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java
index 03374493e3..dc3c458ba9 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java
@@ -265,6 +265,8 @@ public class StagingView extends ViewPart
*/
public static final String VIEW_ID = "org.eclipse.egit.ui.StagingView"; //$NON-NLS-1$
+ private static final String CSS_CLASS = "org-eclipse-egit-ui-StagingView"; //$NON-NLS-1$
+
private static final String EMPTY_STRING = ""; //$NON-NLS-1$
private static final String SORT_ITEM_TOOLBAR_ID = "sortItem"; //$NON-NLS-1$
@@ -2281,6 +2283,7 @@ public class StagingView extends ViewPart
.applyTo(viewer.getControl());
viewer.getTree().setData(FormToolkit.KEY_DRAW_BORDER,
FormToolkit.TREE_BORDER);
+ viewer.getTree().setData(UIUtils.CSS_CLASS_KEY, CSS_CLASS);
StagingViewContentProvider contentProvider = createStagingContentProvider(
unstaged);
viewer.setContentProvider(contentProvider);

Back to the top