Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Zadrozny2015-04-28 17:27:25 +0000
committerFabio Zadrozny2015-04-28 19:51:27 +0000
commitced2dff1a78501f6fd5bb3ef7590e323710a5494 (patch)
tree76c6a479a3d8dbc5ccb4e625f791bade6d960c9a
parentf6d8d457266af08cab2d00163b05c140d4fbb924 (diff)
downloadeclipse.platform.ui-ced2dff1a78501f6fd5bb3ef7590e323710a5494.tar.gz
eclipse.platform.ui-ced2dff1a78501f6fd5bb3ef7590e323710a5494.tar.xz
eclipse.platform.ui-ced2dff1a78501f6fd5bb3ef7590e323710a5494.zip
Bug 465711 - Rendering of tabs when hovering using a dark theme makesI20150428-2000
tab unreadable (CTabRendering) Change-Id: I763285dd36f639ca2331ce9e0d41b146387dc0ba Signed-off-by: Fabio Zadrozny <fabiofz@gmail.com>
-rw-r--r--bundles/org.eclipse.e4.ui.css.swt/plugin.xml8
-rw-r--r--bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/custom/CSSPropertyUnselectHotTabsColorBackgroundHandler.java49
-rw-r--r--bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/internal/css/swt/ICTabRendering.java5
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/CTabRendering.java18
-rw-r--r--bundles/org.eclipse.ui.themes/css/dark/e4-dark_globalstyle.css6
5 files changed, 81 insertions, 5 deletions
diff --git a/bundles/org.eclipse.e4.ui.css.swt/plugin.xml b/bundles/org.eclipse.e4.ui.css.swt/plugin.xml
index 1f7a6f51ff5..96468a6aac7 100644
--- a/bundles/org.eclipse.e4.ui.css.swt/plugin.xml
+++ b/bundles/org.eclipse.e4.ui.css.swt/plugin.xml
@@ -443,6 +443,14 @@
<handler
adapter="org.eclipse.e4.ui.css.swt.dom.CTabFolderElement"
composite="false"
+ handler="org.eclipse.e4.ui.css.swt.properties.custom.CSSPropertyUnselectHotTabsColorBackgroundHandler">
+ <property-name
+ name="unselected-hot-tab-color-background">
+ </property-name>
+ </handler>
+ <handler
+ adapter="org.eclipse.e4.ui.css.swt.dom.CTabFolderElement"
+ composite="false"
handler="org.eclipse.e4.ui.css.swt.properties.custom.CSSPropertyShadowColorHandler">
<property-name
name="swt-shadow-color">
diff --git a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/custom/CSSPropertyUnselectHotTabsColorBackgroundHandler.java b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/custom/CSSPropertyUnselectHotTabsColorBackgroundHandler.java
new file mode 100644
index 00000000000..d1fd4db7fb7
--- /dev/null
+++ b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/custom/CSSPropertyUnselectHotTabsColorBackgroundHandler.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Fabio Zadrozny and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Fabio Zadrozny - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.e4.ui.css.swt.properties.custom;
+
+import org.eclipse.e4.ui.css.core.engine.CSSEngine;
+import org.eclipse.e4.ui.css.swt.properties.AbstractCSSPropertySWTHandler;
+import org.eclipse.e4.ui.internal.css.swt.ICTabRendering;
+import org.eclipse.swt.custom.CTabFolder;
+import org.eclipse.swt.custom.CTabFolderRenderer;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Control;
+import org.w3c.dom.css.CSSValue;
+
+public class CSSPropertyUnselectHotTabsColorBackgroundHandler extends AbstractCSSPropertySWTHandler {
+
+ public static final String UNSELECTED_HOT_TAB_COLOR_BACKGROUND = "unselected-hot-tab-color-background";
+
+ @Override
+ protected void applyCSSProperty(Control control, String property,
+ CSSValue value, String pseudo, CSSEngine engine) throws Exception {
+ if (UNSELECTED_HOT_TAB_COLOR_BACKGROUND.equals(property)) {
+ if (!(control instanceof CTabFolder)) {
+ return;
+ }
+ if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
+ Color newColor = (Color) engine.convert(value, Color.class, control.getDisplay());
+ CTabFolderRenderer renderer = ((CTabFolder) control).getRenderer();
+ if (renderer instanceof ICTabRendering) {
+ ((ICTabRendering) renderer).setUnselectedHotTabsColorBackground(newColor);
+ }
+ }
+ }
+ }
+
+ @Override
+ protected String retrieveCSSProperty(Control control, String property,
+ String pseudo, CSSEngine engine) throws Exception {
+ return null;
+ }
+
+}
diff --git a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/internal/css/swt/ICTabRendering.java b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/internal/css/swt/ICTabRendering.java
index 7fe16bb7809..d2a5f3cdc26 100644
--- a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/internal/css/swt/ICTabRendering.java
+++ b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/internal/css/swt/ICTabRendering.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 IBM Corporation and others.
+ * Copyright (c) 2014-2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Fabio Zadrozny - Bug 465711
*******************************************************************************/
package org.eclipse.e4.ui.internal.css.swt;
@@ -21,6 +22,8 @@ public interface ICTabRendering {
void setUnselectedTabsColor(Color[] colors, int[] percents);
+ void setUnselectedHotTabsColorBackground(Color color);
+
void setTabOutline(Color color);
void setInnerKeyline(Color color);
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/CTabRendering.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/CTabRendering.java
index 474ca98074c..a603822e125 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/CTabRendering.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/CTabRendering.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2014 IBM Corporation and others.
+ * Copyright (c) 2010, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Fabio Zadrozny - Bug 465711
*******************************************************************************/
package org.eclipse.e4.ui.workbench.renderers.swt;
@@ -93,6 +94,8 @@ ICTabRendering {
private CTabFolderRendererWrapper rendererWrapper;
private CTabFolderWrapper parentWrapper;
+ private Color hotUnselectedTabsColorBackground;
+
@Inject
public CTabRendering(CTabFolder parent) {
super(parent);
@@ -101,6 +104,11 @@ ICTabRendering {
}
@Override
+ public void setUnselectedHotTabsColorBackground(Color color) {
+ this.hotUnselectedTabsColorBackground = color;
+ }
+
+ @Override
protected Rectangle computeTrim(int part, int state, int x, int y,
int width, int height) {
boolean onBottom = parent.getTabPosition() == SWT.BOTTOM;
@@ -652,7 +660,13 @@ ICTabRendering {
+ INNER_KEYLINE + OUTER_KEYLINE), bounds.y
+ bounds.height);
- gc.setBackground(gc.getDevice().getSystemColor(SWT.COLOR_WHITE));
+ Color color = hotUnselectedTabsColorBackground;
+ if (color == null) {
+ // Fallback: if color was not set, use white for highlighting
+ // hot tab.
+ color = gc.getDevice().getSystemColor(SWT.COLOR_WHITE);
+ }
+ gc.setBackground(color);
int[] tmpPoints = new int[index];
System.arraycopy(points, 0, tmpPoints, 0, index);
gc.fillPolygon(tmpPoints);
diff --git a/bundles/org.eclipse.ui.themes/css/dark/e4-dark_globalstyle.css b/bundles/org.eclipse.ui.themes/css/dark/e4-dark_globalstyle.css
index 15c059a278f..664f64847b0 100644
--- a/bundles/org.eclipse.ui.themes/css/dark/e4-dark_globalstyle.css
+++ b/bundles/org.eclipse.ui.themes/css/dark/e4-dark_globalstyle.css
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2014 Andrea Guarinoni and others.
+ * Copyright (c) 2010, 2015 Andrea Guarinoni and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,7 +10,7 @@
* Stefan Winkler <stefan@winklerweb.net> - Bug 434189
* Stefan Winkler <stefan@winklerweb.net> - Bug 430848
* Simon Scholz <simon.scholz@vogella.com> - Bug 431635
- * Fabio Zadrozny <fabiofz@gmail.com> - Bug 465148
+ * Fabio Zadrozny <fabiofz@gmail.com> - Bug 465148, 465711
*******************************************************************************/
/*******************************************************************************
@@ -319,10 +319,12 @@ CTabFolder {
swt-selected-tab-fill: '#org-eclipse-ui-workbench-ACTIVE_TAB_BG_END'; /* title background for selected tab */
swt-shadow-visible: false;
swt-corner-radius: 16px;
+ unselected-hot-tab-color-background: #161616; /* Bug 465711 */
}
CTabFolder[style~='SWT.DOWN'][style~='SWT.BOTTOM'] {
/* Set the styles for the bottom inner tabs (Bug 430051): */
swt-tab-renderer: url('bundleclass://org.eclipse.e4.ui.workbench.renderers.swt/org.eclipse.e4.ui.workbench.renderers.swt.CTabRendering');
+ unselected-hot-tab-color-background: #161616; /* Bug 465711 */
}
Form,

Back to the top