aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Webster2014-02-26 12:18:45 (EST)
committerGerrit Code Review @ Eclipse.org2014-02-26 12:18:45 (EST)
commitf66fe6973048e9478a4730f47946b6b3131ec760 (patch)
tree2baeec1aa7afb135e31ade56f7592749fed5c523
parentfb23ca13e5d0318f665fdedf6e0135a2123b1c2f (diff)
downloadeclipse.platform.ui-f66fe6973048e9478a4730f47946b6b3131ec760.zip
eclipse.platform.ui-f66fe6973048e9478a4730f47946b6b3131ec760.tar.gz
eclipse.platform.ui-f66fe6973048e9478a4730f47946b6b3131ec760.tar.bz2
Revert "Bug 355946 - [CSS] "View and Editor Folders" color preferences don't work"refs/changes/86/22586/1
Some more kinks to be worked out This reverts commit fb23ca13e5d0318f665fdedf6e0135a2123b1c2f. Change-Id: I7a7cf25b440a6c14ba9a183ac18ff0ee357aa1a8
-rw-r--r--bundles/org.eclipse.e4.ui.css.swt.theme/schema/org.eclipse.e4.ui.css.swt.theme.exsd42
-rw-r--r--bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/dom/CTabFolderElement.java42
-rw-r--r--bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/dom/CompositeElement.java31
-rw-r--r--bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/css2/CSSPropertyBackgroundSWTHandler.java25
-rw-r--r--bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/custom/CSSPropertySelectedTabsSWTHandler.java18
-rw-r--r--bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/custom/CSSPropertyUnselectedTabsSWTHandler.java47
-rw-r--r--bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/custom/CSSPropertye4SelectedTabFillHandler.java24
-rw-r--r--bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/internal/css/swt/ICTabRendering.java12
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/CTabRendering.java332
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/WBWRenderer.java32
-rw-r--r--bundles/org.eclipse.ui.themes/css/e4_basestyle.css107
-rw-r--r--bundles/org.eclipse.ui.themes/css/e4_default_gtk.css24
-rw-r--r--bundles/org.eclipse.ui.themes/css/e4_default_mac.css23
-rw-r--r--bundles/org.eclipse.ui.themes/css/e4_default_mru_on_win7.css23
-rw-r--r--bundles/org.eclipse.ui.themes/css/e4_default_win7.css23
-rw-r--r--bundles/org.eclipse.ui.themes/css/e4_default_winxp_blu.css23
-rw-r--r--bundles/org.eclipse.ui.themes/css/e4_default_winxp_olv.css25
-rw-r--r--bundles/org.eclipse.ui.themes/plugin.xml6
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewsPreferencePage.java239
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/IWorkbenchRegistryConstants.java10
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ColorsAndFontsPreferencePage.java135
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ColorsAndFontsPreferencePage.properties1
-rw-r--r--tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/workbench/renderers/swt/ThemeDefinitionChangedHandlerTest.java45
23 files changed, 268 insertions, 1021 deletions
diff --git a/bundles/org.eclipse.e4.ui.css.swt.theme/schema/org.eclipse.e4.ui.css.swt.theme.exsd b/bundles/org.eclipse.e4.ui.css.swt.theme/schema/org.eclipse.e4.ui.css.swt.theme.exsd
index 9b9bb56..2703b02 100644
--- a/bundles/org.eclipse.e4.ui.css.swt.theme/schema/org.eclipse.e4.ui.css.swt.theme.exsd
+++ b/bundles/org.eclipse.e4.ui.css.swt.theme/schema/org.eclipse.e4.ui.css.swt.theme.exsd
@@ -20,7 +20,6 @@
<sequence>
<element ref="stylesheet" minOccurs="0" maxOccurs="unbounded"/>
<element ref="theme" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="themeAssociation" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
@@ -164,41 +163,6 @@
</complexType>
</element>
- <element name="themeAssociation">
- <complexType>
- <attribute name="themeId" type="string" use="required">
- <annotation>
- <documentation>
- an Eclipse CSS theme id
- </documentation>
- <appinfo>
- <meta.attribute kind="identifier" basedOn="org.eclipse.e4.ui.css.swt.theme/theme/@id"/>
- </appinfo>
- </annotation>
- </attribute>
- <attribute name="colorAndFontId" type="string" use="required">
- <annotation>
- <documentation>
- an Eclipse legacy Color and Font theme id
- </documentation>
- <appinfo>
- <meta.attribute kind="identifier" basedOn="org.eclipse.ui.themes/theme/@id"/>
- </appinfo>
- </annotation>
- </attribute>
- <attribute name="os_version" type="string">
- <annotation>
- <documentation>
- an optional attribute used to better match the themes
- </documentation>
- <appinfo>
- <meta.attribute kind="identifier" basedOn="org.eclipse.e4.ui.css.swt.theme/theme/@os_version"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
<annotation>
<appinfo>
<meta.section type="since"/>
@@ -234,12 +198,6 @@ A stylesheet contributed to all Systems:
&lt;/stylesheet&gt;
&lt;/pre&gt;
&lt;/p&gt;
-
-The CSS theme and the legacy Colors and Fonts one association:
-&lt;themeAssociation
- themeId=&quot;org.eclipse.e4.ui.css.theme.e4_classic&quot;
- colorAndFontId=&quot;org.eclipse.ui.defaultTheme&quot;&gt;
-&lt;/themeassociation&gt;
</documentation>
</annotation>
diff --git a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/dom/CTabFolderElement.java b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/dom/CTabFolderElement.java
index 1348f6f..2aefdb8 100644
--- a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/dom/CTabFolderElement.java
+++ b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/dom/CTabFolderElement.java
@@ -17,16 +17,14 @@ import org.eclipse.e4.ui.internal.css.swt.ICTabRendering;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Widget;
import org.w3c.dom.Node;
/**
* {@link CSSStylableElement} implementation which wrap SWT {@link CTabFolder}.
- *
+ *
*/
public class CTabFolderElement extends CompositeElement {
- private final static String BACKGROUND_SET_BY_TAB_RENDERER = "bgSetByTabRenderer"; //$NON-NLS-1$
public CTabFolderElement(CTabFolder tabFolder, CSSEngine engine) {
super(tabFolder, engine);
@@ -34,7 +32,7 @@ public class CTabFolderElement extends CompositeElement {
/**
* Compute static pseudo instances.
- *
+ *
*/
@Override
protected void computeStaticPseudoInstances() {
@@ -86,7 +84,6 @@ public class CTabFolderElement extends CompositeElement {
folder.setSelectionBackground((Color) null);
folder.setSelectionForeground((Color) null);
folder.setBackground(null, null);
- resetChildrenBackground(folder);
if (folder.getRenderer() instanceof ICTabRendering) {
ICTabRendering renderer = (ICTabRendering) folder
@@ -97,39 +94,8 @@ public class CTabFolderElement extends CompositeElement {
renderer.setInnerKeyline(null);
renderer.setOuterKeyline(null);
renderer.setShadowColor(null);
- }
- }
-
- private void resetChildrenBackground(Composite composite) {
- for (Control control : composite.getChildren()) {
- resetChildBackground(control);
- if (control instanceof Composite) {
- resetChildrenBackground((Composite) control);
- }
- }
- }
-
- private void resetChildBackground(Control control) {
- Color backgroundSetByRenderer = (Color) control
- .getData(BACKGROUND_SET_BY_TAB_RENDERER);
- if (backgroundSetByRenderer != null) {
- if (control.getBackground() == backgroundSetByRenderer) {
- control.setBackground(null);
- }
- control.setData(BACKGROUND_SET_BY_TAB_RENDERER, null);
- }
- }
-
- public static void setBackgroundOverriddenDuringRenderering(
- Composite composite, Color background) {
- composite.setBackground(background);
- composite.setData(BACKGROUND_SET_BY_TAB_RENDERER, background);
-
- for (Control control : composite.getChildren()) {
- if (!CompositeElement.hasBackgroundOverriddenByCSS(control)) {
- control.setBackground(background);
- control.setData(BACKGROUND_SET_BY_TAB_RENDERER, background);
- }
+ renderer.setActiveToolbarGradient(null, null);
+ renderer.setInactiveToolbarGradient(null, null);
}
}
}
diff --git a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/dom/CompositeElement.java b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/dom/CompositeElement.java
index b3de7d2..e289278 100644
--- a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/dom/CompositeElement.java
+++ b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/dom/CompositeElement.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2014 Angelo Zerr and others.
+ * Copyright (c) 2009, 2010 Angelo Zerr 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
@@ -12,29 +12,24 @@ package org.eclipse.e4.ui.css.swt.dom;
import org.eclipse.e4.ui.css.core.dom.CSSStylableElement;
import org.eclipse.e4.ui.css.core.engine.CSSEngine;
-import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Widget;
import org.w3c.dom.Node;
/**
* {@link CSSStylableElement} implementation which wrap SWT {@link Composite}.
- *
+ *
*/
public class CompositeElement extends ControlElement {
- private final static String BACKGROUND_OVERRIDDEN_BY_CSS_MARKER = "bgOverriddenByCSS";
-
+
public CompositeElement(Composite composite, CSSEngine engine) {
super(composite, engine);
}
- @Override
public int getLength() {
return getComposite().getChildren().length;
}
- @Override
public Node item(int index) {
Widget w = getComposite().getChildren()[index];
return getElement(w);
@@ -44,24 +39,4 @@ public class CompositeElement extends ControlElement {
return (Composite) getNativeWidget();
}
- @Override
- public void reset() {
- super.reset();
- Composite composite = getComposite();
-
- if (composite.getData(BACKGROUND_OVERRIDDEN_BY_CSS_MARKER) != null) {
- composite.setData(BACKGROUND_OVERRIDDEN_BY_CSS_MARKER, null);
- }
- }
-
- public static boolean hasBackgroundOverriddenByCSS(Control control) {
- return control.getData(BACKGROUND_OVERRIDDEN_BY_CSS_MARKER) != null;
- }
-
- public static void setBackgroundOverriddenByCSSMarker(Widget widget) {
- if (widget instanceof Composite && !(widget instanceof CTabFolder)) {
- widget.setData(BACKGROUND_OVERRIDDEN_BY_CSS_MARKER, true);
- }
- }
-
}
diff --git a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/css2/CSSPropertyBackgroundSWTHandler.java b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/css2/CSSPropertyBackgroundSWTHandler.java
index 9b7b1c6..a27c77a 100644
--- a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/css2/CSSPropertyBackgroundSWTHandler.java
+++ b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/css2/CSSPropertyBackgroundSWTHandler.java
@@ -15,7 +15,6 @@ import org.eclipse.e4.ui.css.core.dom.properties.Gradient;
import org.eclipse.e4.ui.css.core.dom.properties.css2.AbstractCSSPropertyBackgroundHandler;
import org.eclipse.e4.ui.css.core.dom.properties.css2.ICSSPropertyBackgroundHandler;
import org.eclipse.e4.ui.css.core.engine.CSSEngine;
-import org.eclipse.e4.ui.css.swt.dom.CompositeElement;
import org.eclipse.e4.ui.css.swt.dom.WidgetElement;
import org.eclipse.e4.ui.css.swt.helpers.CSSSWTColorHelper;
import org.eclipse.e4.ui.css.swt.helpers.CSSSWTImageHelper;
@@ -32,6 +31,7 @@ import org.w3c.dom.css.CSSValue;
public class CSSPropertyBackgroundSWTHandler extends
AbstractCSSPropertyBackgroundHandler {
+
public final static ICSSPropertyBackgroundHandler INSTANCE = new CSSPropertyBackgroundSWTHandler();
@Override
@@ -84,26 +84,18 @@ AbstractCSSPropertyBackgroundHandler {
} else if (widget instanceof Control) {
GradientBackgroundListener.remove((Control) widget);
((Control) widget).setBackground(newColor);
- CompositeElement.setBackgroundOverriddenByCSSMarker(widget);
}
} else if (value.getCssValueType() == CSSValue.CSS_VALUE_LIST) {
Gradient grad = (Gradient) engine.convert(value, Gradient.class,
widget.getDisplay());
- if (widget instanceof CTabItem) {
+ if (widget instanceof CTabItem && "selected".equals(pseudo)) {
CTabFolder folder = ((CTabItem) widget).getParent();
- Color[] colors = CSSSWTColorHelper.getSWTColors(grad,
- folder.getDisplay(), engine);
- int[] percents = CSSSWTColorHelper.getPercents(grad);
-
- if ("selected".equals(pseudo)) {
- folder.setSelectionBackground(colors, percents, true);
- } else {
- folder.setBackground(colors, percents, true);
- }
-
+ folder.setSelectionBackground(
+ CSSSWTColorHelper.getSWTColors(grad, folder.getDisplay(), engine),
+ CSSSWTColorHelper.getPercents(grad),
+ true);
} else if (widget instanceof Control) {
GradientBackgroundListener.handle((Control) widget, grad);
- CompositeElement.setBackgroundOverriddenByCSSMarker(widget);
}
}
}
@@ -148,13 +140,11 @@ AbstractCSSPropertyBackgroundHandler {
}
}
- @Override
public String retrieveCSSPropertyBackgroundAttachment(Object widget,
String pseudo, CSSEngine engine) throws Exception {
return null;
}
- @Override
public String retrieveCSSPropertyBackgroundColor(Object element,
String pseudo, CSSEngine engine) throws Exception {
Widget widget = (Widget) element;
@@ -172,20 +162,17 @@ AbstractCSSPropertyBackgroundHandler {
return engine.convert(color, Color.class, null);
}
- @Override
public String retrieveCSSPropertyBackgroundImage(Object widget,
String pseudo, CSSEngine engine) throws Exception {
// TODO : manage path of Image.
return "none";
}
- @Override
public String retrieveCSSPropertyBackgroundPosition(Object widget,
String pseudo, CSSEngine engine) throws Exception {
return null;
}
- @Override
public String retrieveCSSPropertyBackgroundRepeat(Object widget,
String pseudo, CSSEngine engine) throws Exception {
return null;
diff --git a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/custom/CSSPropertySelectedTabsSWTHandler.java b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/custom/CSSPropertySelectedTabsSWTHandler.java
index 583f32d..88ccbce 100644
--- a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/custom/CSSPropertySelectedTabsSWTHandler.java
+++ b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/custom/CSSPropertySelectedTabsSWTHandler.java
@@ -1,9 +1,9 @@
/*******************************************************************************
- * Copyright (c) 2010, 2014 IBM Corporation and others. All rights reserved. This
+ * Copyright (c) 2010, 2012 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 http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors: IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.e4.ui.css.swt.properties.custom;
@@ -20,28 +20,22 @@ import org.w3c.dom.css.CSSValue;
public class CSSPropertySelectedTabsSWTHandler extends AbstractCSSPropertySWTHandler {
-
+
public static final ICSSPropertyHandler INSTANCE = new CSSPropertySelectedTabsSWTHandler();
-
+
@Override
protected void applyCSSProperty(Control control, String property,
CSSValue value, String pseudo, CSSEngine engine) throws Exception {
- if (!(control instanceof CTabFolder)) {
- return;
- }
+ if (!(control instanceof CTabFolder)) return;
if (value.getCssValueType() == CSSValue.CSS_VALUE_LIST) {
Gradient grad = (Gradient) engine.convert(value, Gradient.class, control.getDisplay());
CTabFolder folder = ((CTabFolder) control);
- if (grad.getValues().isEmpty()) {
- folder.setSelectionBackground(null, null, true);
- return;
- }
Color[] colors = CSSSWTColorHelper.getSWTColors(grad, folder.getDisplay(), engine);
int[] percents = CSSSWTColorHelper.getPercents(grad);
folder.setSelectionBackground(colors, percents, true);
}
}
-
+
@Override
protected String retrieveCSSProperty(Control control, String property,
diff --git a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/custom/CSSPropertyUnselectedTabsSWTHandler.java b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/custom/CSSPropertyUnselectedTabsSWTHandler.java
index 005690f..a503769 100644
--- a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/custom/CSSPropertyUnselectedTabsSWTHandler.java
+++ b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/custom/CSSPropertyUnselectedTabsSWTHandler.java
@@ -3,7 +3,7 @@
* 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: IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.e4.ui.css.swt.properties.custom;
@@ -21,9 +21,7 @@ import org.eclipse.swt.widgets.Control;
import org.w3c.dom.css.CSSValue;
public class CSSPropertyUnselectedTabsSWTHandler extends AbstractCSSPropertySWTHandler {
- private static final String UNSELECTED_TABS_COLOR_PROP = "swt-unselected-tabs-color";
- private static final String DEPRECATED_UNSELECTED_TABS_COLOR_PROP = "unselected-tabs-color";
public static final ICSSPropertyHandler INSTANCE = new CSSPropertyUnselectedTabsSWTHandler();
@@ -33,33 +31,23 @@ public class CSSPropertyUnselectedTabsSWTHandler extends AbstractCSSPropertySWTH
if (!(control instanceof CTabFolder)) {
return;
}
- CTabFolder folder = ((CTabFolder) control);
- CTabFolderRenderer renderer = folder.getRenderer();
- if (!(renderer instanceof ICTabRendering)) {
- return;
- }
-
- if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
- Color color = (Color) engine.convert(value, Color.class,
- control.getDisplay());
- ((ICTabRendering) renderer).setUnselectedTabsColor(color);
- folder.setBackground(color);
- return;
- }
if (value.getCssValueType() == CSSValue.CSS_VALUE_LIST) {
Gradient grad = (Gradient) engine.convert(value, Gradient.class, control.getDisplay());
- Color[] colors = null;
- int[] percents = null;
- if (!grad.getValues().isEmpty()) {
- colors = CSSSWTColorHelper.getSWTColors(grad,
- control.getDisplay(), engine);
- percents = CSSSWTColorHelper.getPercents(grad);
- }
- if (isUnselectedTabsColorProp(property)) {
- ((ICTabRendering) renderer).setUnselectedTabsColor(colors,
- percents);
- }
+ CTabFolder folder = ((CTabFolder) control);
+ Color[] colors = CSSSWTColorHelper.getSWTColors(grad, folder.getDisplay(), engine);
+ int[] percents = CSSSWTColorHelper.getPercents(grad);
folder.setBackground(colors, percents, true);
+
+ CTabFolderRenderer renderer = ((CTabFolder) control).getRenderer();
+ if (renderer instanceof ICTabRendering) {
+ if ("selected".equals(pseudo)) {
+ ((ICTabRendering) renderer).setActiveToolbarGradient(
+ colors, percents);
+ } else {
+ ((ICTabRendering) renderer)
+ .setInactiveToolbarGradient(colors, percents);
+ }
+ }
}
}
@@ -71,9 +59,4 @@ public class CSSPropertyUnselectedTabsSWTHandler extends AbstractCSSPropertySWTH
return null;
}
- private boolean isUnselectedTabsColorProp(String property) {
- return UNSELECTED_TABS_COLOR_PROP.equals(property)
- || DEPRECATED_UNSELECTED_TABS_COLOR_PROP.equals(property);
- }
-
}
diff --git a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/custom/CSSPropertye4SelectedTabFillHandler.java b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/custom/CSSPropertye4SelectedTabFillHandler.java
index 7d6d8b0..b5df60a 100644
--- a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/custom/CSSPropertye4SelectedTabFillHandler.java
+++ b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/custom/CSSPropertye4SelectedTabFillHandler.java
@@ -10,9 +10,7 @@
*******************************************************************************/
package org.eclipse.e4.ui.css.swt.properties.custom;
-import org.eclipse.e4.ui.css.core.dom.properties.Gradient;
import org.eclipse.e4.ui.css.core.engine.CSSEngine;
-import org.eclipse.e4.ui.css.swt.helpers.CSSSWTColorHelper;
import org.eclipse.e4.ui.css.swt.properties.AbstractCSSPropertySWTHandler;
import org.eclipse.e4.ui.internal.css.swt.ICTabRendering;
import org.eclipse.swt.custom.CTabFolder;
@@ -22,7 +20,7 @@ import org.eclipse.swt.widgets.Control;
import org.w3c.dom.css.CSSValue;
public class CSSPropertye4SelectedTabFillHandler extends
-AbstractCSSPropertySWTHandler {
+ AbstractCSSPropertySWTHandler {
@Override
protected void applyCSSProperty(Control control, String property,
@@ -30,22 +28,12 @@ AbstractCSSPropertySWTHandler {
if (!(control instanceof CTabFolder)) {
return;
}
- CTabFolder folder = (CTabFolder) control;
- CTabFolderRenderer renderer = folder.getRenderer();
- if (!(renderer instanceof ICTabRendering)) {
- return;
- }
if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
- Color newColor = (Color) engine.convert(value, Color.class,
- control.getDisplay());
- ((ICTabRendering) renderer).setSelectedTabFill(newColor);
- } else if (value.getCssValueType() == CSSValue.CSS_VALUE_LIST) {
- Gradient grad = (Gradient) engine.convert(value, Gradient.class,
- control.getDisplay());
- Color[] colors = CSSSWTColorHelper.getSWTColors(grad,
- folder.getDisplay(), engine);
- int[] percents = CSSSWTColorHelper.getPercents(grad);
- ((ICTabRendering) renderer).setSelectedTabFill(colors, percents);
+ Color newColor = (Color) engine.convert(value, Color.class, control.getDisplay());
+ CTabFolderRenderer renderer = ((CTabFolder) control).getRenderer();
+ if (renderer instanceof ICTabRendering) {
+ ((ICTabRendering) renderer).setSelectedTabFill(newColor);
+ }
}
}
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 7fe16bb..380856d 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
@@ -4,7 +4,7 @@
* 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:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -15,12 +15,6 @@ import org.eclipse.swt.graphics.Color;
public interface ICTabRendering {
void setSelectedTabFill(Color color);
- void setSelectedTabFill(Color[] colors, int[] percents);
-
- void setUnselectedTabsColor(Color color);
-
- void setUnselectedTabsColor(Color[] colors, int[] percents);
-
void setTabOutline(Color color);
void setInnerKeyline(Color color);
@@ -29,6 +23,10 @@ public interface ICTabRendering {
void setShadowColor(Color color);
+ void setActiveToolbarGradient(Color[] color, int[] percents);
+
+ void setInactiveToolbarGradient(Color[] color, int[] percents);
+
void setCornerRadius(int radius);
void setShadowVisible(boolean visible);
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 43d4cc4..ad7472f 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
@@ -10,11 +10,6 @@
*******************************************************************************/
package org.eclipse.e4.ui.workbench.renderers.swt;
-import static org.eclipse.e4.ui.css.swt.dom.CTabFolderElement.setBackgroundOverriddenDuringRenderering;
-import static org.eclipse.e4.ui.css.swt.dom.CompositeElement.hasBackgroundOverriddenByCSS;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
import javax.inject.Inject;
import org.eclipse.e4.ui.internal.css.swt.ICTabRendering;
import org.eclipse.swt.SWT;
@@ -30,13 +25,12 @@ import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.graphics.Region;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
@SuppressWarnings("restriction")
public class CTabRendering extends CTabFolderRenderer implements
- ICTabRendering {
+ ICTabRendering {
+
// Constants for circle drawing
final static int LEFT_TOP = 0;
final static int LEFT_BOTTOM = 1;
@@ -76,25 +70,14 @@ public class CTabRendering extends CTabFolderRenderer implements
Color[] inactiveToolbar;
int[] inactivePercents;
boolean active;
-
- Color[] selectedTabFillColors;
- int[] selectedTabFillPercents;
-
- Color[] unselectedTabsColors;
- int[] unselectedTabsPercents;
-
+ Color selectedTabFillColor;
Color tabOutlineColor;
int paddingLeft = 0, paddingRight = 0, paddingTop = 0, paddingBottom = 0;
- private CTabFolderRendererWrapper rendererWrapper;
- private CTabFolderWrapper parentWrapper;
-
@Inject
public CTabRendering(CTabFolder parent) {
super(parent);
- parentWrapper = new CTabFolderWrapper(parent);
- rendererWrapper = new CTabFolderRendererWrapper(this);
}
protected Rectangle computeTrim(int part, int state, int x, int y,
@@ -152,6 +135,7 @@ public class CTabRendering extends CTabFolderRenderer implements
case PART_HEADER:
x = x - (INNER_KEYLINE + OUTER_KEYLINE) - sideDropWidth;
width = width + 2 * (INNER_KEYLINE + OUTER_KEYLINE + sideDropWidth);
+
break;
case PART_BORDER:
x = x - INNER_KEYLINE - OUTER_KEYLINE - sideDropWidth
@@ -201,9 +185,6 @@ public class CTabRendering extends CTabFolderRenderer implements
protected void draw(int part, int state, Rectangle bounds, GC gc) {
switch (part) {
- case PART_BACKGROUND:
- this.drawCustomBackground(gc, bounds, state);
- return;
case PART_BODY:
this.drawTabBody(gc, bounds, state);
return;
@@ -271,8 +252,7 @@ public class CTabRendering extends CTabFolderRenderer implements
trim.width = bounds.width - trim.width;
// XXX: The magic numbers need to be cleaned up. See https://bugs.eclipse.org/425777 for details.
- trim.height = (parent.getTabHeight() + (onBottom ? 7 : 4))
- - trim.height;
+ trim.height = (parent.getTabHeight() + (onBottom ? 7 : 4)) - trim.height;
trim.x = -trim.x;
trim.y = onBottom ? bounds.height - parent.getTabHeight() - 1 - header
@@ -371,7 +351,7 @@ public class CTabRendering extends CTabFolderRenderer implements
Rectangle mappedBounds = display
.map(parent, parent.getParent(), bounds);
parent.getParent().drawBackground(gc, bounds.x, bounds.y, bounds.width,
- bounds.height, mappedBounds.x, mappedBounds.y);
+ bounds.height, mappedBounds.x, mappedBounds.y);
// Shadow
if (shadowEnabled)
@@ -478,23 +458,24 @@ public class CTabRendering extends CTabFolderRenderer implements
+ OUTER_KEYLINE), bounds.y + bounds.height);// bounds.height
// +
// 4);
-
+ if (selectedTabFillColor == null)
+ selectedTabFillColor = gc.getDevice().getSystemColor(
+ SWT.COLOR_WHITE);
+ gc.setBackground(selectedTabFillColor);
+ gc.setForeground(selectedTabFillColor);
+ Color gradientTop = null;
Pattern backgroundPattern = null;
- if (selectedTabFillColors == null) {
- setSelectedTabFill(gc.getDevice().getSystemColor(SWT.COLOR_WHITE));
- }
- if (selectedTabFillColors.length == 1) {
- gc.setBackground(selectedTabFillColors[0]);
- gc.setForeground(selectedTabFillColors[0]);
- } else if (!onBottom && selectedTabFillColors.length == 2) {
- // for now we support the 2-colors gradient for selected tab
+ if (!active && !onBottom) {
+ RGB blendColor = gc.getDevice()
+ .getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW).getRGB();
+ RGB topGradient = blend(blendColor, parent.getParent()
+ .getBackground().getRGB(), 40);
+ gradientTop = new Color(gc.getDevice(), topGradient);
backgroundPattern = new Pattern(gc.getDevice(), 0, 0, 0,
- bounds.height + 1, selectedTabFillColors[0],
- selectedTabFillColors[1]);
+ bounds.height + 1, gradientTop, gc.getDevice()
+ .getSystemColor(SWT.COLOR_WHITE));
gc.setBackgroundPattern(backgroundPattern);
- gc.setForeground(selectedTabFillColors[1]);
}
-
int[] tmpPoints = new int[index];
System.arraycopy(points, 0, tmpPoints, 0, index);
gc.fillPolygon(tmpPoints);
@@ -527,16 +508,15 @@ public class CTabRendering extends CTabFolderRenderer implements
if (!onBottom) {
gc.drawLine(startX, 0, endX, 0);
}
- }
+ if (gradientTop != null)
+ gradientTop.dispose();
+ if (backgroundPattern != null)
+ backgroundPattern.dispose();
+ if (gradientLineTop != null)
+ gradientLineTop.dispose();
+ if (foregroundPattern != null)
+ foregroundPattern.dispose();
- if (backgroundPattern != null) {
- backgroundPattern.dispose();
- }
- if (gradientLineTop != null) {
- gradientLineTop.dispose();
- }
- if (foregroundPattern != null) {
- foregroundPattern.dispose();
}
}
@@ -988,22 +968,7 @@ public class CTabRendering extends CTabFolderRenderer implements
}
public void setSelectedTabFill(Color color) {
- setSelectedTabFill(new Color[] { color }, new int[] { 100 });
- }
-
- public void setSelectedTabFill(Color[] colors, int[] percents) {
- selectedTabFillColors = colors;
- selectedTabFillPercents = percents;
- parent.redraw();
- }
-
- public void setUnselectedTabsColor(Color color) {
- setUnselectedTabsColor(new Color[] { color }, new int[] { 100 });
- }
-
- public void setUnselectedTabsColor(Color[] colors, int[] percents) {
- unselectedTabsColors = colors;
- unselectedTabsPercents = percents;
+ this.selectedTabFillColor = color;
parent.redraw();
}
@@ -1030,243 +995,4 @@ public class CTabRendering extends CTabFolderRenderer implements
public void setActive(boolean active) {
this.active = active;
}
-
- private void drawCustomBackground(GC gc, Rectangle bounds, int state) {
- boolean selected = (state & SWT.SELECTED) != 0;
- Color defaultBackground = selected ? parent.getSelectionBackground()
- : parent.getBackground();
- boolean vertical = selected ? parentWrapper
- .isSelectionGradientVertical() : parentWrapper
- .isGradientVertical();
- Rectangle partHeaderBounds = computeTrim(PART_HEADER, state, bounds.x,
- bounds.y, bounds.width, bounds.height);
-
- drawUnselectedTabBackground(gc, partHeaderBounds, state, vertical,
- defaultBackground);
- drawTabBackground(gc, partHeaderBounds, state, vertical,
- defaultBackground);
- drawChildrenBackground(partHeaderBounds);
- }
-
- private void drawUnselectedTabBackground(GC gc, Rectangle partHeaderBounds,
- int state, boolean vertical, Color defaultBackground) {
- if (unselectedTabsColors == null) {
- boolean selected = (state & SWT.SELECTED) != 0;
- unselectedTabsColors = selected ? parentWrapper
- .getSelectionGradientColors() : parentWrapper
- .getGradientColors();
- unselectedTabsPercents = selected ? parentWrapper
- .getSelectionGradientPercents() :
- parentWrapper.getGradientPercents();
- }
- if (unselectedTabsColors == null) {
- unselectedTabsColors = new Color[] { gc.getDevice().getSystemColor(
- SWT.COLOR_WHITE) };
- unselectedTabsPercents = new int[] { 100 };
- }
-
- rendererWrapper.drawBackground(gc, partHeaderBounds.x,
- partHeaderBounds.y - 1, partHeaderBounds.width,
- partHeaderBounds.height, defaultBackground,
- unselectedTabsColors, unselectedTabsPercents, vertical);
- }
-
- private void drawTabBackground(GC gc, Rectangle partHeaderBounds,
- int state, boolean vertical, Color defaultBackground) {
- Color[] colors = selectedTabFillColors;
- int[] percents = selectedTabFillPercents;
-
- if (colors != null && colors.length == 2) {
- colors = new Color[] { colors[1], colors[0] };
- }
- if (colors == null) {
- boolean selected = (state & SWT.SELECTED) != 0;
- colors = selected ? parentWrapper.getSelectionGradientColors() :
- parentWrapper.getGradientColors();
- percents = selected ? parentWrapper.getSelectionGradientPercents() :
- parentWrapper.getGradientPercents();
- }
- if (colors == null) {
- colors = new Color[] { gc.getDevice().getSystemColor(SWT.COLOR_WHITE) };
- percents = new int[] { 100 };
- }
- rendererWrapper.drawBackground(gc, partHeaderBounds.x, partHeaderBounds.height - 1, partHeaderBounds.width,
- parent.getBounds().height, defaultBackground, colors, percents,
- vertical);
- }
-
- private void drawChildrenBackground(Rectangle partHeaderBounds) {
- for (Control control : parent.getChildren()) {
- if (control instanceof Composite
- && !hasBackgroundOverriddenByCSS(control)) {
- drawChildBackground((Composite) control, partHeaderBounds);
- }
- }
- }
-
- private void drawChildBackground(Composite composite,
- Rectangle partHeaderBounds) {
- Rectangle rec = composite.getBounds();
- Color background = null;
- boolean partOfHeader = rec.y >= partHeaderBounds.y
- && rec.y < partHeaderBounds.height;
-
- if (!partOfHeader && selectedTabFillColors != null) {
- background = selectedTabFillColors.length == 2 ? selectedTabFillColors[1]
- : selectedTabFillColors[0];
- }
-
- setBackgroundOverriddenDuringRenderering(composite, background);
- }
-
- private static class CTabFolderRendererWrapper extends
- ReflectionSupport<CTabFolderRenderer> {
- private Method drawBackgroundMethod;
-
- public CTabFolderRendererWrapper(CTabFolderRenderer instance) {
- super(instance);
- }
-
- public void drawBackground(GC gc, int x, int y, int width, int height,
- Color defaultBackground, Color[] colors, int[] percents,
- boolean vertical) {
- if (drawBackgroundMethod == null) {
- drawBackgroundMethod = getMethod("drawBackground", //$NON-NLS-1$
- new Class<?>[] { GC.class, int[].class, int.class,
- int.class, int.class, int.class, Color.class,
- Image.class, Color[].class, int[].class,
- boolean.class });
- }
- executeMethod(drawBackgroundMethod, new Object[] { gc, null, x, y,
- width, height, defaultBackground, null, colors, percents,
- vertical });
- }
- }
-
- private static class CTabFolderWrapper extends
- ReflectionSupport<CTabFolder> {
- private Field selectionGradientVerticalField;
-
- private Field gradientVerticalField;
-
- private Field selectionGradientColorsField;
-
- private Field selectionGradientPercentsField;
-
- private Field gradientColorsField;
-
- private Field gradientPercentsField;
-
- public CTabFolderWrapper(CTabFolder instance) {
- super(instance);
- }
-
- public boolean isSelectionGradientVertical() {
- if (selectionGradientVerticalField == null) {
- selectionGradientVerticalField = getField("selectionGradientVertical"); //$NON-NLS-1$
- }
- Boolean result = (Boolean) getFieldValue(selectionGradientVerticalField);
- return result != null ? result : true;
- }
-
- public boolean isGradientVertical() {
- if (gradientVerticalField == null) {
- gradientVerticalField = getField("gradientVertical"); //$NON-NLS-1$
- }
- Boolean result = (Boolean) getFieldValue(gradientVerticalField);
- return result != null ? result : true;
- }
-
- public Color[] getSelectionGradientColors() {
- if (selectionGradientColorsField == null) {
- selectionGradientColorsField = getField("selectionGradientColorsField"); //$NON-NLS-1$
- }
- return (Color[]) getFieldValue(selectionGradientColorsField);
- }
-
- public int[] getSelectionGradientPercents() {
- if (selectionGradientPercentsField == null) {
- selectionGradientPercentsField = getField("selectionGradientPercents"); //$NON-NLS-1$
- }
- return (int[]) getFieldValue(selectionGradientPercentsField);
- }
-
- public Color[] getGradientColors() {
- if (gradientColorsField == null) {
- gradientColorsField = getField("gradientColors"); //$NON-NLS-1$
- }
- return (Color[]) getFieldValue(gradientColorsField);
- }
-
- public int[] getGradientPercents() {
- if (gradientPercentsField == null) {
- gradientPercentsField = getField("gradientPercents"); //$NON-NLS-1$
- }
- return (int[]) getFieldValue(gradientPercentsField);
- }
- }
-
- private static class ReflectionSupport<T> {
- private T instance;
-
- public ReflectionSupport(T instance) {
- this.instance = instance;
- }
-
- protected Object getFieldValue(Field field) {
- Object value = null;
- if (field != null) {
- boolean accessible = field.isAccessible();
- try {
- field.setAccessible(true);
- value = field.get(instance);
- } catch (Exception exc) {
- // do nothing
- } finally {
- field.setAccessible(accessible);
- }
- }
- return value;
- }
-
- protected Field getField(String name) {
- Class<?> cls = instance.getClass();
- while (!cls.equals(Object.class)) {
- try {
- return cls.getDeclaredField(name);
- } catch (Exception exc) {
- cls = cls.getSuperclass();
- }
- }
- return null;
- }
-
- protected Object executeMethod(Method method, Object... params) {
- Object value = null;
- if (method != null) {
- boolean accessible = method.isAccessible();
- try {
- method.setAccessible(true);
- value = method.invoke(instance, params);
- } catch (Exception exc) {
- // do nothing
- } finally {
- method.setAccessible(accessible);
- }
- }
- return value;
- }
-
- protected Method getMethod(String name, Class<?>... params) {
- Class<?> cls = instance.getClass();
- while (!cls.equals(Object.class)) {
- try {
- return cls.getDeclaredMethod(name, params);
- } catch (Exception exc) {
- cls = cls.getSuperclass();
- }
- }
- return null;
- }
- }
}
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/WBWRenderer.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/WBWRenderer.java
index af80793..8ae99b2 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/WBWRenderer.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/WBWRenderer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2014 IBM Corporation and others.
+ * Copyright (c) 2008, 2013 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
@@ -129,7 +129,7 @@ public class WBWRenderer extends SWTPartRenderer {
private EventHandler shellUpdater;
private EventHandler visibilityHandler;
private EventHandler sizeHandler;
- private ThemeDefinitionChangedHandler themeDefinitionChanged;
+ private EventHandler themeDefinitionChanged;
@Inject
private EModelService modelService;
@@ -324,8 +324,6 @@ public class WBWRenderer extends SWTPartRenderer {
eventBroker.unsubscribe(visibilityHandler);
eventBroker.unsubscribe(sizeHandler);
eventBroker.unsubscribe(themeDefinitionChanged);
-
- themeDefinitionChanged.dispose();
}
/**
@@ -844,8 +842,6 @@ public class WBWRenderer extends SWTPartRenderer {
@SuppressWarnings("restriction")
protected static class ThemeDefinitionChangedHandler implements
EventHandler {
- protected Set<Resource> unusedResources = new HashSet<Resource>();
-
public void handleEvent(Event event) {
Object element = event.getProperty(IEventBroker.DATA);
@@ -853,6 +849,7 @@ public class WBWRenderer extends SWTPartRenderer {
return;
}
+ List<Object> unusedResources = new ArrayList<Object>();
Set<CSSEngine> engines = new HashSet<CSSEngine>();
// In theory we can have multiple engines since API allows it.
@@ -865,15 +862,14 @@ public class WBWRenderer extends SWTPartRenderer {
}
for (CSSEngine engine : engines) {
- for (Object resource : removeResources(engine
- .getResourcesRegistry())) {
- if (resource instanceof Resource
- && !((Resource) resource).isDisposed()) {
- unusedResources.add((Resource) resource);
- }
- }
+ unusedResources.addAll(removeResources(engine
+ .getResourcesRegistry()));
engine.reapply();
}
+
+ for (Object resource : unusedResources) {
+ disposeResource(resource);
+ }
}
protected CSSEngine getEngine(MWindow window) {
@@ -890,13 +886,11 @@ public class WBWRenderer extends SWTPartRenderer {
return Collections.emptyList();
}
- public void dispose() {
- for (Resource resource : unusedResources) {
- if (!resource.isDisposed()) {
- resource.dispose();
- }
+ protected void disposeResource(Object resource) {
+ if (resource instanceof Resource
+ && !((Resource) resource).isDisposed()) {
+ ((Resource) resource).dispose();
}
- unusedResources.clear();
}
}
diff --git a/bundles/org.eclipse.ui.themes/css/e4_basestyle.css b/bundles/org.eclipse.ui.themes/css/e4_basestyle.css
index bac9780..a1cd3e1 100644
--- a/bundles/org.eclipse.ui.themes/css/e4_basestyle.css
+++ b/bundles/org.eclipse.ui.themes/css/e4_basestyle.css
@@ -10,97 +10,6 @@
* Lars Vogel <Lars.Vogel@gmail.com> - Bug 420836
*******************************************************************************/
-/* New ColorDefinitions for the E4 default theme */
-ThemesExtension { color-definition:
- '#org-eclipse-ui-workbench-INACTIVE_UNSELECTED_TABS_COLOR_START',
- '#org-eclipse-ui-workbench-INACTIVE_UNSELECTED_TABS_COLOR_END',
- '#org-eclipse-ui-workbench-INACTIVE_TAB_OUTER_KEYLINE_COLOR',
- '#org-eclipse-ui-workbench-INACTIVE_TAB_INNER_KEYLINE_COLOR',
- '#org-eclipse-ui-workbench-INACTIVE_TAB_OUTLINE_COLOR',
- '#org-eclipse-ui-workbench-ACTIVE_UNSELECTED_TABS_COLOR_START',
- '#org-eclipse-ui-workbench-ACTIVE_UNSELECTED_TABS_COLOR_END',
- '#org-eclipse-ui-workbench-ACTIVE_TAB_OUTER_KEYLINE_COLOR',
- '#org-eclipse-ui-workbench-ACTIVE_TAB_INNER_KEYLINE_COLOR',
- '#org-eclipse-ui-workbench-ACTIVE_TAB_OUTLINE_COLOR';
-}
-
-ColorDefinition#org-eclipse-ui-workbench-INACTIVE_UNSELECTED_TABS_COLOR_START {
- color: #FFFFFF;
- category: '#org-eclipse-ui-presentation-default';
- label: 'Inactive, unselected part color start';
-}
-
-ColorDefinition#org-eclipse-ui-workbench-INACTIVE_UNSELECTED_TABS_COLOR_END {
- color: #FFFFFF;
- category: '#org-eclipse-ui-presentation-default';
- label: 'Inactive, unselected part color end';
-}
-
-ColorDefinition#org-eclipse-ui-workbench-INACTIVE_TAB_OUTER_KEYLINE_COLOR {
- color: #FFFFFF;
- category: '#org-eclipse-ui-presentation-default';
- label: 'Inactive part outer keyline color';
-}
-
-ColorDefinition#org-eclipse-ui-workbench-INACTIVE_TAB_INNER_KEYLINE_COLOR {
- color: #FFFFFF;
- category: '#org-eclipse-ui-presentation-default';
- label: 'Inactive part inner keyline color';
-}
-
-ColorDefinition#org-eclipse-ui-workbench-INACTIVE_TAB_OUTLINE_COLOR {
- color: #B6BCCC;
- category: '#org-eclipse-ui-presentation-default';
- label: 'Inactive part outline color';
-}
-
-ColorDefinition#org-eclipse-ui-workbench-ACTIVE_UNSELECTED_TABS_COLOR_START {
- color: #FFFFFF;
- category: '#org-eclipse-ui-presentation-default';
- label: 'Active, unselected part color begin';
-}
-
-ColorDefinition#org-eclipse-ui-workbench-ACTIVE_UNSELECTED_TABS_COLOR_END {
- color: #FFFFFF;
- category: '#org-eclipse-ui-presentation-default';
- label: 'Active, unselected part color end';
-}
-
-ColorDefinition#org-eclipse-ui-workbench-ACTIVE_TAB_OUTER_KEYLINE_COLOR {
- color: #FFFFFF;
- category: '#org-eclipse-ui-presentation-default';
- label: 'Active part outer keyline color';
-}
-
-ColorDefinition#org-eclipse-ui-workbench-ACTIVE_TAB_INNER_KEYLINE_COLOR {
- color: #FFFFFF;
- category: '#org-eclipse-ui-presentation-default';
- label: 'Active part inner keyline color';
-}
-
-ColorDefinition#org-eclipse-ui-workbench-ACTIVE_TAB_OUTLINE_COLOR {
- color: #B6BCCC;
- category: '#org-eclipse-ui-presentation-default';
- label: 'Active part outline color';
-}
-
-/* Already existing ColorDefinitions overridden for the E4 default theme */
-ColorDefinition#org-eclipse-ui-workbench-INACTIVE_TAB_BG_START {
- color: #D4D0C8;
-}
-
-ColorDefinition#org-eclipse-ui-workbench-INACTIVE_TAB_BG_END {
- color: #FFFFFF;
-}
-
-ColorDefinition#org-eclipse-ui-workbench-ACTIVE_TAB_BG_START{
- color: #FFFFFF;
-}
-
-ColorDefinition#org-eclipse-ui-workbench-ACTIVE_TAB_BG_END {
- color: #FFFFFF;
-}
-
.MTrimmedWindow.topLevel {
margin-top: 3px;
margin-bottom: 3px;
@@ -122,22 +31,18 @@ ColorDefinition#org-eclipse-ui-workbench-ACTIVE_TAB_BG_END {
.MPartStack {
swt-tab-renderer: url('bundleclass://org.eclipse.e4.ui.workbench.renderers.swt/org.eclipse.e4.ui.workbench.renderers.swt.CTabRendering');
- swt-selected-tab-fill: '#org-eclipse-ui-workbench-INACTIVE_TAB_BG_START' '#org-eclipse-ui-workbench-INACTIVE_TAB_BG_END' 100% 100%;
- swt-unselected-tabs-color: '#org-eclipse-ui-workbench-INACTIVE_UNSELECTED_TABS_COLOR_START' '#org-eclipse-ui-workbench-INACTIVE_UNSELECTED_TABS_COLOR_END' 100% 100%;
- swt-outer-keyline-color: '#org-eclipse-ui-workbench-INACTIVE_TAB_OUTER_KEYLINE_COLOR';
- swt-inner-keyline-color: '#org-eclipse-ui-workbench-INACTIVE_TAB_INNER_KEYLINE_COLOR';
- swt-tab-outline: '#org-eclipse-ui-workbench-INACTIVE_TAB_OUTLINE_COLOR';
+ swt-unselected-tabs-color: #FFFFFF #FFFFFF #FFFFFF 100% 100%;
+ swt-outer-keyline-color: #FFFFFF;
+ swt-inner-keyline-color: #FFFFFF;
padding: 0px 2px 2px;
+ swt-tab-outline: #B6BCCC;
swt-shadow-visible: false;
swt-mru-visible: false;
}
.MPartStack.active {
- swt-selected-tab-fill: '#org-eclipse-ui-workbench-ACTIVE_TAB_BG_START' '#org-eclipse-ui-workbench-ACTIVE_TAB_BG_END' 100% 100%;
- swt-unselected-tabs-color: '#org-eclipse-ui-workbench-ACTIVE_UNSELECTED_TABS_COLOR_START' '#org-eclipse-ui-workbench-ACTIVE_UNSELECTED_TABS_COLOR_END' 100% 100%;
- swt-outer-keyline-color: '#org-eclipse-ui-workbench-ACTIVE_TAB_OUTER_KEYLINE_COLOR';
- swt-inner-keyline-color: '#org-eclipse-ui-workbench-ACTIVE_TAB_INNER_KEYLINE_COLOR';
- swt-tab-outline: '#org-eclipse-ui-workbench-ACTIVE_TAB_OUTLINE_COLOR';
+ swt-inner-keyline-color: #FFFFFF;
+ swt-tab-outline: #B6BCCC;
swt-shadow-visible: false;
}
diff --git a/bundles/org.eclipse.ui.themes/css/e4_default_gtk.css b/bundles/org.eclipse.ui.themes/css/e4_default_gtk.css
index 7dd2ed1..4d5ed1d 100644
--- a/bundles/org.eclipse.ui.themes/css/e4_default_gtk.css
+++ b/bundles/org.eclipse.ui.themes/css/e4_default_gtk.css
@@ -12,18 +12,6 @@
@import url("platform:/plugin/org.eclipse.ui.themes/css/e4_basestyle.css");
-ColorDefinition#org-eclipse-ui-workbench-ACTIVE_UNSELECTED_TABS_COLOR_START {
- color: #DCDCDC;
-}
-
-ColorDefinition#org-eclipse-ui-workbench-ACTIVE_UNSELECTED_TABS_COLOR_END {
- color: #E1E1E1;
-}
-
-ColorDefinition#org-eclipse-ui-workbench-ACTIVE_TAB_OUTLINE_COLOR {
- color: #B4B4B4;
-}
-
.MTrimmedWindow {
background-color: #E2E2E2;
}
@@ -46,12 +34,24 @@ ColorDefinition#org-eclipse-ui-workbench-ACTIVE_TAB_OUTLINE_COLOR {
handle-image: url(./gtkHandle.png);
}
+.MPartStack.active {
+ swt-unselected-tabs-color: #DCDCDC #E1E1E1 #FFFFFF 100% 100%;
+ swt-outer-keyline-color: #B4B4B4;
+ swt-tab-outline: #B4B4B4;
+}
+
#PerspectiveSwitcher {
background-color: COLOR-WIDGET-BACKGROUND #E2E2E2 100%;
eclipse-perspective-keyline-color: #B4B4B4 #B4B4B4;
}
#org-eclipse-ui-editorss {
+ swt-tab-renderer: url('bundleclass://org.eclipse.e4.ui.workbench.renderers.swt/org.eclipse.e4.ui.workbench.renderers.swt.CTabRendering');
+ swt-unselected-tabs-color: #F0F0F0 #F0F0F0 #F0F0F0 100% 100%;
+ swt-outer-keyline-color: #B4B4B4;
+ swt-inner-keyline-color: #F0F0F0;
+ swt-tab-outline: #F0F0F0;
+ color: #F0F0F0;
swt-tab-height: 8px;
padding: 0px 5px 7px;
}
diff --git a/bundles/org.eclipse.ui.themes/css/e4_default_mac.css b/bundles/org.eclipse.ui.themes/css/e4_default_mac.css
index a2a4e51..b3dbdb4 100644
--- a/bundles/org.eclipse.ui.themes/css/e4_default_mac.css
+++ b/bundles/org.eclipse.ui.themes/css/e4_default_mac.css
@@ -12,18 +12,6 @@
@import url("platform:/plugin/org.eclipse.ui.themes/css/e4_basestyle.css");
-ColorDefinition#org-eclipse-ui-workbench-ACTIVE_UNSELECTED_TABS_COLOR_START {
- color: #F6F6F6;
-}
-
-ColorDefinition#org-eclipse-ui-workbench-ACTIVE_UNSELECTED_TABS_COLOR_END {
- color: #D6D6D6;
-}
-
-ColorDefinition#org-eclipse-ui-workbench-ACTIVE_TAB_OUTER_KEYLINE_COLOR {
- color: #C4C5C1;
-}
-
.MTrimmedWindow {
background-color: #E8E8E8;
}
@@ -46,12 +34,23 @@ ColorDefinition#org-eclipse-ui-workbench-ACTIVE_TAB_OUTER_KEYLINE_COLOR {
handle-image: url(./macHandle.png);
}
+.MPartStack.active {
+ swt-unselected-tabs-color: #F6F6F6 #D3D3D3 #D1D1D1 #D1D1D1 #D6D6D6 #D6D6D6 #FFFFFF 20% 45% 60% 70% 100% 100%;
+ swt-outer-keyline-color: #C4C5C1;
+}
+
#PerspectiveSwitcher {
background-color: #F0F0F0 #E8E8E8 100%;
eclipse-perspective-keyline-color: #515151 #515151;
}
#org-eclipse-ui-editorss {
+ swt-tab-renderer: url('bundleclass://org.eclipse.e4.ui.workbench.renderers.swt/org.eclipse.e4.ui.workbench.renderers.swt.CTabRendering');
+ swt-unselected-tabs-color: #D6DDE5 #D6DDE5 #D6DDE5 100% 100%;
+ swt-outer-keyline-color: #D6DDE5;
+ swt-inner-keyline-color: #D6DDE5;
+ swt-tab-outline: #D6DDE5;
+ color: #D6DDE5;
swt-tab-height: 8px;
padding: 0px 5px 7px;
}
diff --git a/bundles/org.eclipse.ui.themes/css/e4_default_mru_on_win7.css b/bundles/org.eclipse.ui.themes/css/e4_default_mru_on_win7.css
index bd18a2b..324791d 100644
--- a/bundles/org.eclipse.ui.themes/css/e4_default_mru_on_win7.css
+++ b/bundles/org.eclipse.ui.themes/css/e4_default_mru_on_win7.css
@@ -12,18 +12,6 @@
@import url("platform:/plugin/org.eclipse.ui.themes/css/e4_basestyle.css");
-ColorDefinition#org-eclipse-ui-workbench-ACTIVE_UNSELECTED_TABS_COLOR_START {
- color: #D2E1F0;
-}
-
-ColorDefinition#org-eclipse-ui-workbench-ACTIVE_UNSELECTED_TABS_COLOR_END {
- color: #CEDDED;
-}
-
-ColorDefinition#org-eclipse-ui-workbench-ACTIVE_TAB_OUTER_KEYLINE_COLOR {
- color: #B6BCCC;
-}
-
.MTrimmedWindow {
background-color: #E1E6F6;
}
@@ -46,11 +34,22 @@ ColorDefinition#org-eclipse-ui-workbench-ACTIVE_TAB_OUTER_KEYLINE_COLOR {
background-image: url(./win7.png);
}
+.MPartStack.active {
+ swt-unselected-tabs-color: #F3F9FF #D0DFEE #CEDDED #CEDDED #D2E1F0 #D2E1F0 #FFFFFF 20% 45% 60% 70% 100% 100%;
+ swt-outer-keyline-color: #B6BCCC;
+}
+
#PerspectiveSwitcher {
background-color: #F5F7FC #E1E6F6 100%;
}
#org-eclipse-ui-editorss {
+ swt-tab-renderer: url('bundleclass://org.eclipse.e4.ui.workbench.renderers.swt/org.eclipse.e4.ui.workbench.renderers.swt.CTabRendering');
+ swt-unselected-tabs-color: #F0F0F0 #F0F0F0 #F0F0F0 100% 100%;
+ swt-outer-keyline-color: #B4B4B4;
+ swt-inner-keyline-color: #F0F0F0;
+ swt-tab-outline: #F0F0F0;
+ color: #F0F0F0;
swt-tab-height: 8px;
padding: 0px 5px 7px;
}
diff --git a/bundles/org.eclipse.ui.themes/css/e4_default_win7.css b/bundles/org.eclipse.ui.themes/css/e4_default_win7.css
index 57cec6e..7d96ed7 100644
--- a/bundles/org.eclipse.ui.themes/css/e4_default_win7.css
+++ b/bundles/org.eclipse.ui.themes/css/e4_default_win7.css
@@ -12,18 +12,6 @@
@import url("platform:/plugin/org.eclipse.ui.themes/css/e4_basestyle.css");
-ColorDefinition#org-eclipse-ui-workbench-ACTIVE_UNSELECTED_TABS_COLOR_START {
- color: #D2E1F0;
-}
-
-ColorDefinition#org-eclipse-ui-workbench-ACTIVE_UNSELECTED_TABS_COLOR_END {
- color: #CEDDED;
-}
-
-ColorDefinition#org-eclipse-ui-workbench-ACTIVE_TAB_OUTER_KEYLINE_COLOR {
- color: #B6BCCC;
-}
-
.MTrimmedWindow {
background-color: #E1E6F6;
}
@@ -46,11 +34,22 @@ ColorDefinition#org-eclipse-ui-workbench-ACTIVE_TAB_OUTER_KEYLINE_COLOR {
handle-image: url(./win7Handle.png);
}
+.MPartStack.active {
+ swt-unselected-tabs-color: #F3F9FF #D0DFEE #CEDDED #CEDDED #D2E1F0 #D2E1F0 #FFFFFF 20% 45% 60% 70% 100% 100%;
+ swt-outer-keyline-color: #B6BCCC;
+}
+
#PerspectiveSwitcher {
background-color: #F5F7FC #E1E6F6 100%;
}
#org-eclipse-ui-editorss {
+ swt-tab-renderer: url('bundleclass://org.eclipse.e4.ui.workbench.renderers.swt/org.eclipse.e4.ui.workbench.renderers.swt.CTabRendering');
+ swt-unselected-tabs-color: #F0F0F0 #F0F0F0 #F0F0F0 100% 100%;
+ swt-outer-keyline-color: #B4B4B4;
+ swt-inner-keyline-color: #F0F0F0;
+ swt-tab-outline: #F0F0F0;
+ color: #F0F0F0;
swt-tab-height: 8px;
padding: 0px 5px 7px;
}
diff --git a/bundles/org.eclipse.ui.themes/css/e4_default_winxp_blu.css b/bundles/org.eclipse.ui.themes/css/e4_default_winxp_blu.css
index 7cbe02d..a8e1917 100644
--- a/bundles/org.eclipse.ui.themes/css/e4_default_winxp_blu.css
+++ b/bundles/org.eclipse.ui.themes/css/e4_default_winxp_blu.css
@@ -12,18 +12,6 @@
@import url("platform:/plugin/org.eclipse.ui.themes/css/e4_basestyle.css");
-ColorDefinition#org-eclipse-ui-workbench-ACTIVE_UNSELECTED_TABS_COLOR_START {
- color: #F1F4FD;
-}
-
-ColorDefinition#org-eclipse-ui-workbench-ACTIVE_UNSELECTED_TABS_COLOR_END {
- color: #C9D7F2;
-}
-
-ColorDefinition#org-eclipse-ui-workbench-ACTIVE_TAB_OUTER_KEYLINE_COLOR {
- color: #B8C7E5;
-}
-
.MTrimmedWindow {
background-color: #F0ECE0;
}
@@ -47,12 +35,23 @@ ColorDefinition#org-eclipse-ui-workbench-ACTIVE_TAB_OUTER_KEYLINE_COLOR {
handle-image: url(./winXPBluHandle.png);
}
+.MPartStack.active {
+ swt-unselected-tabs-color: #F1F4FD #C9DAF3 #BED4F1 #BED4F1 #C9D7F2 #C9D7F2 #FFFFFF 20% 45% 60% 70% 100% 100%;
+ swt-outer-keyline-color: #B8C7E5;
+}
+
#PerspectiveSwitcher {
background-color: #F5F3ED #F0ECE0 100%;
eclipse-perspective-keyline-color: #7F91B5 #7F91B5;
}
#org-eclipse-ui-editorss {
+ swt-tab-renderer: url('bundleclass://org.eclipse.e4.ui.workbench.renderers.swt/org.eclipse.e4.ui.workbench.renderers.swt.CTabRendering');
+ swt-unselected-tabs-color: #F0F0F0 #F0F0F0 #F0F0F0 100% 100%;
+ swt-outer-keyline-color: #B4B4B4;
+ swt-inner-keyline-color: #F0F0F0;
+ swt-tab-outline: #F0F0F0;
+ color: #F0F0F0;
swt-tab-height: 8px;
padding: 0px 5px 7px;
}
diff --git a/bundles/org.eclipse.ui.themes/css/e4_default_winxp_olv.css b/bundles/org.eclipse.ui.themes/css/e4_default_winxp_olv.css
index 5b90af7..d15de93 100644
--- a/bundles/org.eclipse.ui.themes/css/e4_default_winxp_olv.css
+++ b/bundles/org.eclipse.ui.themes/css/e4_default_winxp_olv.css
@@ -9,19 +9,6 @@
* IBM Corporation - initial API and implementation
* Lars Vogel <Lars.Vogel@gmail.com> - Bug 420836
*******************************************************************************/
-@import url("platform:/plugin/org.eclipse.ui.themes/css/e4_basestyle.css");
-
-ColorDefinition#org-eclipse-ui-workbench-ACTIVE_UNSELECTED_TABS_COLOR_START {
- color: #E6E3C3;
-}
-
-ColorDefinition#org-eclipse-ui-workbench-ACTIVE_UNSELECTED_TABS_COLOR_END {
- color: #EDEACA;
-}
-
-ColorDefinition#org-eclipse-ui-workbench-ACTIVE_TAB_OUTER_KEYLINE_COLOR {
- color: #BFCDA4;
-}
.MTrimmedWindow {
margin-top: 2px;
@@ -50,7 +37,12 @@ ColorDefinition#org-eclipse-ui-workbench-ACTIVE_TAB_OUTER_KEYLINE_COLOR {
}
.MPartStack {
+ swt-tab-renderer: url('bundleclass://org.eclipse.e4.ui.workbench.renderers.swt/org.eclipse.e4.ui.workbench.renderers.swt.CTabRendering');
+ swt-unselected-tabs-color: #FFFFFF #FFFFFF #FFFFFF 100% 100%;
+ swt-outer-keyline-color: #FFFFFF;
+ swt-inner-keyline-color: #FFFFFF;
swt-simple: true;
+ padding: 0px 10px 11px;
swt-mru-visible: false;
}
@@ -58,6 +50,13 @@ ColorDefinition#org-eclipse-ui-workbench-ACTIVE_TAB_OUTER_KEYLINE_COLOR {
background-image: url(./winXPOlive.png);
}
+.MPartStack.active {
+ swt-unselected-tabs-color: #E6E3C3 #EDEACA #FFFFFF 100% 100%;
+ swt-outer-keyline-color: #BFCDA4;
+ swt-inner-keyline-color: #FFFFFF;
+ swt-tab-outline: #B6BCCC;
+}
+
#PerspectiveSwitcher {
background-color: #F5F3ED #F0ECE0 100%;
eclipse-perspective-keyline-color: #A7B680 #A7B680;
diff --git a/bundles/org.eclipse.ui.themes/plugin.xml b/bundles/org.eclipse.ui.themes/plugin.xml
index 0117d6a..110d111 100644
--- a/bundles/org.eclipse.ui.themes/plugin.xml
+++ b/bundles/org.eclipse.ui.themes/plugin.xml
@@ -69,12 +69,6 @@
os="win32"
os_version="6.1">
</theme>
-
- <themeAssociation
- themeId="org.eclipse.e4.ui.css.theme.e4_classic"
- colorAndFontId="org.eclipse.ui.defaultTheme">
- </themeAssociation>
-
</extension>
</plugin>
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewsPreferencePage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewsPreferencePage.java
index 4099111..28a7f78 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewsPreferencePage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewsPreferencePage.java
@@ -12,20 +12,6 @@
package org.eclipse.ui.internal.dialogs;
-import static org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants.ATT_COLOR_AND_FONT_ID;
-import static org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants.ATT_OS_VERSION;
-import static org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants.ATT_THEME_ASSOCIATION;
-import static org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants.ATT_THEME_ID;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.RegistryFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.ui.css.swt.theme.ITheme;
import org.eclipse.e4.ui.css.swt.theme.IThemeEngine;
@@ -45,10 +31,13 @@ import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTException;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
@@ -72,8 +61,6 @@ import org.eclipse.ui.themes.IThemeManager;
*/
public class ViewsPreferencePage extends PreferencePage implements
IWorkbenchPreferencePage {
- private static final String E4_THEME_EXTENSION_POINT = "org.eclipse.e4.ui.css.swt.theme"; //$NON-NLS-1$
-
private IThemeEngine engine;
private ComboViewer themeIdCombo;
private ITheme currentTheme;
@@ -81,10 +68,8 @@ public class ViewsPreferencePage extends PreferencePage implements
private Button enableAnimations;
private Button useColoredLabels;
- private Text colorsAndFontsThemeDescriptionText;
- private ComboViewer colorsAndFontsThemeCombo;
- private ColorsAndFontsTheme currentColorsAndFontsTheme;
- private Map<String, String> themeAssociations;
+ private Text themeDescriptionText;
+ private Combo themeCombo;
@Override
protected Control createContents(Composite parent) {
@@ -109,8 +94,9 @@ public class ViewsPreferencePage extends PreferencePage implements
themeIdCombo.setSelection(new StructuredSelection(currentTheme));
}
themeIdCombo.addSelectionChangedListener(new ISelectionChangedListener() {
+
public void selectionChanged(SelectionChangedEvent event) {
- ITheme selection = getSelectedTheme();
+ ITheme selection = getSelection();
engine.setTheme(selection, false);
try {
((PreferencePageEnhancer) Tweaklets.get(PreferencePageEnhancer.KEY))
@@ -118,13 +104,11 @@ public class ViewsPreferencePage extends PreferencePage implements
} catch (SWTException e) {
WorkbenchPlugin.log("Failed to set CSS preferences", e); //$NON-NLS-1$
}
- selectColorsAndFontsTheme(getColorAndFontThemeIdByThemeId(selection.getId()));
}
});
- currentColorsAndFontsTheme = getCurrentColorsAndFontsTheme();
- createColorsAndFontsThemeCombo(comp);
- createColorsAndFontsThemeDescriptionText(comp);
+ createThemeCombo(comp);
+ createThemeDescriptionText(comp);
createEnableAnimationsPref(comp);
createColoredLabelsPref(comp);
@@ -132,15 +116,6 @@ public class ViewsPreferencePage extends PreferencePage implements
.setSelection(currentTheme);
((PreferencePageEnhancer) Tweaklets.get(PreferencePageEnhancer.KEY)).createContents(comp);
- if (currentTheme != null) {
- String colorsAndFontsThemeId = getColorAndFontThemeIdByThemeId(currentTheme
- .getId());
- if (colorsAndFontsThemeId != null
- && !currentColorsAndFontsTheme.getId().equals(colorsAndFontsThemeId)) {
- colorsAndFontsThemeId = currentColorsAndFontsTheme.getId();
- }
- selectColorsAndFontsTheme(colorsAndFontsThemeId);
- }
return comp;
}
@@ -171,7 +146,7 @@ public class ViewsPreferencePage extends PreferencePage implements
}
/** @return the currently selected theme or null if there are no themes */
- private ITheme getSelectedTheme() {
+ private ITheme getSelection() {
return (ITheme) ((IStructuredSelection) themeIdCombo.getSelection()).getFirstElement();
}
@@ -184,21 +159,26 @@ public class ViewsPreferencePage extends PreferencePage implements
@Override
public boolean performOk() {
- ITheme theme = getSelectedTheme();
- if (theme != null) {
- engine.setTheme(getSelectedTheme(), true);
- }
-
- boolean themeChanged = theme != null && !theme.equals(currentTheme);
- boolean colorsAndFontsThemeChanged = !PlatformUI.getWorkbench().getThemeManager()
- .getCurrentTheme().getId().equals(currentColorsAndFontsTheme.getId());
-
- if (themeChanged || colorsAndFontsThemeChanged) {
- MessageDialog.openWarning(getShell(), WorkbenchMessages.ThemeChangeWarningTitle,
- WorkbenchMessages.ThemeChangeWarningText);
+ if (getSelection() != null) {
+ if (!getSelection().equals(currentTheme)) {
+ MessageDialog.openWarning(getShell(), WorkbenchMessages.ThemeChangeWarningTitle,
+ WorkbenchMessages.ThemeChangeWarningText);
+ }
+ engine.setTheme(getSelection(), true);
}
-
IPreferenceStore apiStore = PrefUtil.getAPIPreferenceStore();
+ int idx = themeCombo.getSelectionIndex();
+ if (idx <= 0) {
+ PlatformUI.getWorkbench().getThemeManager()
+ .setCurrentTheme(IThemeManager.DEFAULT_THEME);
+ refreshThemeCombo(IThemeManager.DEFAULT_THEME);
+ } else {
+ IThemeDescriptor applyTheme = WorkbenchPlugin.getDefault().getThemeRegistry()
+ .getThemes()[idx - 1];
+ PlatformUI.getWorkbench().getThemeManager().setCurrentTheme(applyTheme.getId());
+ refreshThemeCombo(applyTheme.getId());
+ }
+ refreshThemeDescriptionText();
apiStore.setValue(IWorkbenchPreferenceConstants.ENABLE_ANIMATIONS,
enableAnimations.getSelection());
apiStore.setValue(IWorkbenchPreferenceConstants.USE_COLORED_LABELS,
@@ -207,18 +187,8 @@ public class ViewsPreferencePage extends PreferencePage implements
return super.performOk();
}
- private void setColorsAndFontsTheme(ColorsAndFontsTheme theme) {
- org.eclipse.ui.themes.ITheme currentTheme = PlatformUI.getWorkbench().getThemeManager()
- .getCurrentTheme();
- if (theme != null && !currentTheme.getId().equals(theme.getId())) {
- PlatformUI.getWorkbench().getThemeManager().setCurrentTheme(theme.getId());
- }
- }
-
@Override
protected void performDefaults() {
- setColorsAndFontsTheme(currentColorsAndFontsTheme);
-
((PreferencePageEnhancer) Tweaklets.get(PreferencePageEnhancer.KEY)).performDefaults();
engine.setTheme(defaultTheme, true);
if (engine.getActiveTheme() != null) {
@@ -234,35 +204,22 @@ public class ViewsPreferencePage extends PreferencePage implements
@Override
public boolean performCancel() {
- setColorsAndFontsTheme(currentColorsAndFontsTheme);
-
if (currentTheme != null) {
engine.setTheme(currentTheme, false);
}
return super.performCancel();
}
- private void createColorsAndFontsThemeCombo(Composite composite) {
+ private void createThemeCombo(Composite composite) {
new Label(composite, SWT.NONE).setText(WorkbenchMessages.ViewsPreference_currentTheme);
- colorsAndFontsThemeCombo = new ComboViewer(composite, SWT.READ_ONLY);
- colorsAndFontsThemeCombo.getControl().setLayoutData(
- new GridData(SWT.FILL, SWT.CENTER, true, false));
- colorsAndFontsThemeCombo.setLabelProvider(new LabelProvider() {
- @Override
- public String getText(Object element) {
- return ((ColorsAndFontsTheme) element).getLabel();
+ themeCombo = new Combo(composite, SWT.READ_ONLY);
+ themeCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ themeCombo.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ refreshThemeDescriptionText();
}
});
- colorsAndFontsThemeCombo.setContentProvider(new ArrayContentProvider());
- colorsAndFontsThemeCombo.setInput(getColorsAndFontsThemes());
- colorsAndFontsThemeCombo.getControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- colorsAndFontsThemeCombo.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- ColorsAndFontsTheme colorsAndFontsTheme = getSelectedColorsAndFontsTheme();
- refreshColorsAndFontsThemeDescriptionText(colorsAndFontsTheme);
- setColorsAndFontsTheme(colorsAndFontsTheme);
- }
- });
+ refreshThemeCombo(PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getId());
}
/**
@@ -272,12 +229,11 @@ public class ViewsPreferencePage extends PreferencePage implements
* @param parent
* the parent <code>Composite</code>.
*/
- private void createColorsAndFontsThemeDescriptionText(Composite parent) {
+ private void createThemeDescriptionText(Composite parent) {
new Label(parent, SWT.NONE)
.setText(WorkbenchMessages.ViewsPreference_currentThemeDescription);
- colorsAndFontsThemeDescriptionText = new Text(parent, SWT.H_SCROLL | SWT.V_SCROLL
- | SWT.READ_ONLY
+ themeDescriptionText = new Text(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY
| SWT.BORDER | SWT.WRAP);
GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
// give a height hint that'll show at least two lines (and let the
@@ -285,65 +241,31 @@ public class ViewsPreferencePage extends PreferencePage implements
GC gc = new GC(parent);
layoutData.heightHint = Dialog.convertHeightInCharsToPixels(gc.getFontMetrics(), 2);
gc.dispose();
- colorsAndFontsThemeDescriptionText.setLayoutData(layoutData);
- }
+ themeDescriptionText.setLayoutData(layoutData);
- @SuppressWarnings("unchecked")
- private void selectColorsAndFontsTheme(String colorAndFontThemeId) {
- if (colorAndFontThemeId == null) {
- colorAndFontThemeId = currentColorsAndFontsTheme.getId();
- }
-
- List<ColorsAndFontsTheme> colorsAndFontsThemes = (List<ColorsAndFontsTheme>) colorsAndFontsThemeCombo
- .getInput();
-
- for (int i = 0; i < colorsAndFontsThemes.size(); i++) {
- if (colorsAndFontsThemes.get(i).getId().equals(colorAndFontThemeId)) {
- colorsAndFontsThemeCombo.getCombo().select(i);
- break;
- }
- }
+ refreshThemeDescriptionText();
}
- private String getColorAndFontThemeIdByThemeId(String themeId) {
- if (themeAssociations == null) {
- themeAssociations = createThemeAssociations();
+ private void refreshThemeDescriptionText() {
+ String description = null;
+ int idx = themeCombo.getSelectionIndex();
+ // idx == 0 is "Default" which has no description
+ if (idx > 0) {
+ IThemeDescriptor theme = WorkbenchPlugin.getDefault().getThemeRegistry().getThemes()[idx - 1];
+ description = theme.getDescription();
}
-
- // first get by exact matching (together with os_version)
- String result = themeAssociations.get(themeId);
-
- if (result == null) {
- for (Map.Entry<String, String> entry : themeAssociations.entrySet()) {
- if (themeId.startsWith(entry.getKey())) {
- return entry.getValue();
- }
- }
+ if (description == null) {
+ description = ""; //$NON-NLS-1$
}
-
- return result;
+ themeDescriptionText.setText(description);
}
- private Map<String, String> createThemeAssociations() {
- Map<String, String> result = new HashMap<String, String>();
- IExtensionRegistry registry = RegistryFactory.getRegistry();
- IExtensionPoint extPoint = registry.getExtensionPoint(E4_THEME_EXTENSION_POINT);
-
- for (IExtension e : extPoint.getExtensions()) {
- for (IConfigurationElement ce : e.getConfigurationElements()) {
- if (ce.getName().equals(ATT_THEME_ASSOCIATION)) {
- String themeId = ce.getAttribute(ATT_THEME_ID);
- String osVersion = ce.getAttribute(ATT_OS_VERSION);
- result.put(osVersion != null ? themeId + osVersion : themeId,
- ce.getAttribute(ATT_COLOR_AND_FONT_ID));
- }
- }
- }
- return result;
- }
-
- private List<ColorsAndFontsTheme> getColorsAndFontsThemes() {
- List<ColorsAndFontsTheme> result = new ArrayList<ColorsAndFontsTheme>();
+ /**
+ * @param themeToSelect
+ * the id of the theme to be selected
+ */
+ private void refreshThemeCombo(String themeToSelect) {
+ themeCombo.removeAll();
org.eclipse.ui.themes.ITheme currentTheme = PlatformUI.getWorkbench().getThemeManager()
.getCurrentTheme();
@@ -354,60 +276,21 @@ public class ViewsPreferencePage extends PreferencePage implements
defaultThemeString = NLS.bind(WorkbenchMessages.ViewsPreference_currentThemeFormat,
new Object[] { defaultThemeString });
}
- result.add(new ColorsAndFontsTheme(IThemeManager.DEFAULT_THEME, defaultThemeString));
+ themeCombo.add(defaultThemeString);
String themeString;
+ int selection = 0;
for (int i = 0; i < descs.length; i++) {
themeString = descs[i].getName();
if (descs[i].getId().equals(currentTheme.getId())) {
themeString = NLS.bind(WorkbenchMessages.ViewsPreference_currentThemeFormat,
new Object[] { themeString });
}
- result.add(new ColorsAndFontsTheme(descs[i].getId(), themeString));
- }
- return result;
- }
-
- private void refreshColorsAndFontsThemeDescriptionText(ColorsAndFontsTheme theme) {
- String description = ""; //$NON-NLS-1$
- IThemeDescriptor[] descs = WorkbenchPlugin.getDefault().getThemeRegistry().getThemes();
-
- for (int i = 0; theme != null && description == null && i < descs.length; i++) {
- if (descs[i].getId().equals(theme.getId())) {
- description = descs[i].getDescription();
+ if (themeToSelect.equals(descs[i].getId())) {
+ selection = i + 1;
}
+ themeCombo.add(themeString);
}
- colorsAndFontsThemeDescriptionText.setText(description);
- }
-
- private ColorsAndFontsTheme getSelectedColorsAndFontsTheme() {
- return (ColorsAndFontsTheme) ((IStructuredSelection) colorsAndFontsThemeCombo
- .getSelection()).getFirstElement();
- }
-
- private ColorsAndFontsTheme getCurrentColorsAndFontsTheme() {
- org.eclipse.ui.themes.ITheme theme = PlatformUI.getWorkbench().getThemeManager()
- .getCurrentTheme();
-
- return new ColorsAndFontsTheme(theme.getId(), theme.getLabel());
- }
-
-
- private static class ColorsAndFontsTheme {
- private String label;
- private String id;
-
- public ColorsAndFontsTheme(String id, String label) {
- this.id = id;
- this.label = label;
- }
-
- public String getId() {
- return id;
- }
-
- public String getLabel() {
- return label;
- }
+ themeCombo.select(selection);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/IWorkbenchRegistryConstants.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/IWorkbenchRegistryConstants.java
index 5913343..71e2efb 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/IWorkbenchRegistryConstants.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/IWorkbenchRegistryConstants.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2014 IBM Corporation and others.
+ * Copyright (c) 2004, 2011 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
@@ -1353,12 +1353,4 @@ public interface IWorkbenchRegistryConstants {
public static final String ATT_FIND = "find"; //$NON-NLS-1$
public static final String TAG_KEYWORD_REFERENCE = "keywordReference"; //$NON-NLS-1$
-
- public static final String ATT_THEME_ASSOCIATION = "themeAssociation"; //$NON-NLS-1$
-
- public static final String ATT_THEME_ID = "themeId"; //$NON-NLS-1$
-
- public static final String ATT_COLOR_AND_FONT_ID = "colorAndFontId"; //$NON-NLS-1$
-
- public static final String ATT_OS_VERSION = "os_version"; //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ColorsAndFontsPreferencePage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ColorsAndFontsPreferencePage.java
index ec0eb28..0d2ff3f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ColorsAndFontsPreferencePage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ColorsAndFontsPreferencePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2014 IBM Corporation and others.
+ * Copyright (c) 2003, 2013 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
@@ -31,7 +31,6 @@ import org.eclipse.jface.resource.StringConverter;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IColorProvider;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.IFontProvider;
import org.eclipse.jface.viewers.ISelection;
@@ -62,7 +61,6 @@ import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.graphics.Resource;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -125,8 +123,6 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
* Marks font tokens in EXPANDED_ELEMENTS_PREF and SELECTED_ELEMENT_PREF.
*/
private static final char MARKER_FONT = 'F';
-
- private static final int DEFINITION_NOT_AVAIL_COLOR = SWT.COLOR_WIDGET_LIGHT_SHADOW;
private class ThemeContentProvider implements ITreeContentProvider {
@@ -359,8 +355,7 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
}
private class PresentationLabelProvider extends LabelProvider implements
- IFontProvider,
- IColorProvider {
+ IFontProvider {
private HashMap fonts = new HashMap();
@@ -378,7 +373,8 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
} else {
// Some theme definition element has been modified and we
// need to refresh the viewer
- refreshAllLabels();
+ tree.getViewer().setContentProvider(new ThemeContentProvider());
+ tree.getViewer().collapseAll();
}
}
};
@@ -458,7 +454,8 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
fonts.put(baseFont, font);
}
return font;
- }
+ }
+
return JFaceResources.getDialogFont();
}
@@ -467,16 +464,11 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
*/
public Image getImage(Object element) {
if (element instanceof ColorDefinition) {
- Display display = tree.getDisplay();
Color c = colorRegistry
.get(((ColorDefinition) element).getId());
- Color foregroundColor = tree.getViewer().getControl().getForeground();
- if (c == null) {
- c = display.getSystemColor(SWT.COLOR_WHITE);
- foregroundColor = display.getSystemColor(DEFINITION_NOT_AVAIL_COLOR);
- }
Image image = (Image) images.get(c);
- if (image == null) {
+ if (image == null) {
+ Display display = tree.getDisplay();
ensureImageSize();
image = new Image(display, imageSize, imageSize);
@@ -487,7 +479,8 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
.getBackground());
gc.drawRectangle(0, 0, imageSize - 1, imageSize - 1);
- gc.setForeground(foregroundColor);
+ gc.setForeground(tree.getViewer().getControl()
+ .getForeground());
gc.setBackground(c);
int offset = (imageSize - usableImageSize) / 2;
@@ -567,34 +560,6 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
}
return false;
}
-
- /**
- * Returns the DEFINITION_NOT_AVAIL_COLOR color when definition is not
- * present in the current theme or null when it is available
- *
- * @param def
- * the definition
- * @return the DEFINITION_NOT_AVAIL_COLOR color or null
- */
- @Override
- public Color getForeground(Object element) {
- if (element instanceof ThemeElementDefinition && !isAvailableInCurrentTheme((ThemeElementDefinition) element)) {
- return tree.getDisplay().getSystemColor(DEFINITION_NOT_AVAIL_COLOR);
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.IColorProvider#getBackground(java.lang.
- * Object)
- */
- @Override
- public Color getBackground(Object element) {
- return null;
- }
}
/**
@@ -1004,19 +969,11 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
tree.getViewer().setExpandedState(element,
!tree.getViewer().getExpandedState(element));
- if (element instanceof ThemeElementDefinition) {
- ThemeElementDefinition definition = (ThemeElementDefinition) element;
- if (definition.isOverridden() || definition.isAddedByCss()
- || !isAvailableInCurrentTheme(definition)) {
- return;
- }
- if (element instanceof FontDefinition) {
- editFont(tree.getDisplay());
- } else if (element instanceof ColorDefinition) {
- editColor(tree.getDisplay());
- }
- updateControls();
- }
+ if (element instanceof FontDefinition)
+ editFont(tree.getDisplay());
+ else if (element instanceof ColorDefinition)
+ editColor(tree.getDisplay());
+ updateControls();
}
});
@@ -1294,7 +1251,7 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
IThemeManager.CHANGE_CURRENT_THEME)) {
updateThemeInfo(themeManager);
refreshCategory();
- refreshAllLabels();
+ tree.getViewer().refresh(); // refresh all the labels in the tree
}
}
};
@@ -1910,16 +1867,11 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
if (fontDefinition != null) {
boolean isDefault = isDefault(fontDefinition);
boolean hasDefault = fontDefinition.getDefaultsTo() != null;
- fontChangeButton.setEnabled(!fontDefinition.isOverridden()
- && isAvailableInCurrentTheme(fontDefinition));
- fontSystemButton.setEnabled(!fontDefinition.isOverridden()
- && isAvailableInCurrentTheme(fontDefinition));
- fontResetButton.setEnabled(!isDefault && !fontDefinition.isOverridden()
- && isAvailableInCurrentTheme(fontDefinition));
- editDefaultButton.setEnabled(hasDefault && isDefault && !fontDefinition.isOverridden()
- && isAvailableInCurrentTheme(fontDefinition));
- goToDefaultButton.setEnabled(hasDefault && !fontDefinition.isOverridden()
- && isAvailableInCurrentTheme(fontDefinition));
+ fontChangeButton.setEnabled(!fontDefinition.isOverridden());
+ fontSystemButton.setEnabled(!fontDefinition.isOverridden());
+ fontResetButton.setEnabled(!isDefault && !fontDefinition.isOverridden());
+ editDefaultButton.setEnabled(hasDefault && isDefault && !fontDefinition.isOverridden());
+ goToDefaultButton.setEnabled(hasDefault && !fontDefinition.isOverridden());
setCurrentFont(fontDefinition);
return;
}
@@ -1927,15 +1879,12 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
if (colorDefinition != null) {
boolean isDefault = isDefault(getSelectedColorDefinition());
boolean hasDefault = colorDefinition.getDefaultsTo() != null;
- fontChangeButton.setEnabled(!colorDefinition.isOverridden()
- && isAvailableInCurrentTheme(colorDefinition));
+ fontChangeButton.setEnabled(!colorDefinition.isOverridden());
fontSystemButton.setEnabled(false);
- fontResetButton.setEnabled(!isDefault && !colorDefinition.isOverridden()
- && isAvailableInCurrentTheme(colorDefinition));
- editDefaultButton.setEnabled(hasDefault && isDefault && !colorDefinition.isOverridden()
- && isAvailableInCurrentTheme(colorDefinition));
- goToDefaultButton.setEnabled(hasDefault && !colorDefinition.isOverridden()
- && isAvailableInCurrentTheme(colorDefinition));
+ fontResetButton.setEnabled(!isDefault && !colorDefinition.isOverridden());
+ editDefaultButton
+ .setEnabled(hasDefault && isDefault && !colorDefinition.isOverridden());
+ goToDefaultButton.setEnabled(hasDefault && !colorDefinition.isOverridden());
setCurrentColor(colorDefinition);
return;
}
@@ -1962,7 +1911,7 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
private void setCurrentFont(FontDefinition fontDefinition) {
currentFont = fontRegistry.get(fontDefinition.getId());
- FontData[] fontData = currentFont != null ? currentFont.getFontData() : new FontData[0];
+ FontData[] fontData = currentFont.getFontData();
// recalculate sample text
StringBuffer tmp = new StringBuffer();
@@ -1982,14 +1931,19 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
}
}
fontSampleText = tmp.toString();
- descriptionText.setText(fomatDescription(fontDefinition, currentFont));
+
+ String description = fontDefinition.getDescription();
+ descriptionText.setText(description == null ? "" : description); //$NON-NLS-1$
+
fontSampler.redraw();
}
public void setCurrentColor(ColorDefinition colorDefinition) {
currentColor = colorRegistry.get(colorDefinition.getId());
colorSampler.redraw();
- descriptionText.setText(fomatDescription(colorDefinition, currentColor));
+
+ String description = colorDefinition.getDescription();
+ descriptionText.setText(description == null ? "" : description); //$NON-NLS-1$
}
private Composite createFontPreviewControl() {
@@ -2155,25 +2109,4 @@ public final class ColorsAndFontsPreferencePage extends PreferencePage
workbench.getApplication());
}
}
-
- private void refreshAllLabels() {
- updateThemeInfo(PlatformUI.getWorkbench().getThemeManager());
- tree.getViewer().refresh(); // refresh all the labels in the tree
- }
-
- private boolean isAvailableInCurrentTheme(ThemeElementDefinition definition) {
- if (definition instanceof FontDefinition) {
- return fontRegistry.get(definition.getId()) != null;
- }
- return colorRegistry.get(definition.getId()) != null;
- }
-
- private String fomatDescription(ThemeElementDefinition definition, Resource resource) {
- String description = definition.getDescription() != null ? definition.getDescription() : ""; //$NON-NLS-1$
- if (resource != null) {
- return description;
- }
- return MessageFormat.format(RESOURCE_BUNDLE.getString("definitionNotAvailInTheme"), //$NON-NLS-1$
- new Object[] { description }).trim();
- }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ColorsAndFontsPreferencePage.properties b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ColorsAndFontsPreferencePage.properties
index 93f256b..76fac52 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ColorsAndFontsPreferencePage.properties
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ColorsAndFontsPreferencePage.properties
@@ -28,4 +28,3 @@ boldFont=Bold
italicFont=Italic
fontTextSample=The quick brown fox jumps over the lazy dog.
fontColorSample=Sample text
-definitionNotAvailInTheme={0} (not available in the current theme)
diff --git a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/workbench/renderers/swt/ThemeDefinitionChangedHandlerTest.java b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/workbench/renderers/swt/ThemeDefinitionChangedHandlerTest.java
index e914275..23113c8 100644
--- a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/workbench/renderers/swt/ThemeDefinitionChangedHandlerTest.java
+++ b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/workbench/renderers/swt/ThemeDefinitionChangedHandlerTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013, 2014 IBM Corporation and others.
+ * Copyright (c) 2013 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
@@ -22,7 +22,6 @@ import static org.mockito.Mockito.verify;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
-import java.util.Set;
import junit.framework.TestCase;
import org.eclipse.e4.core.services.events.IEventBroker;
import org.eclipse.e4.ui.css.core.engine.CSSEngine;
@@ -88,11 +87,13 @@ public class ThemeDefinitionChangedHandlerTest extends TestCase {
verify(engine, times(1)).reapply();
verify(handler, times(1)).removeResources(registry);
- assertEquals(1, handler.getUnusedResources().size());
- assertTrue(handler.getUnusedResources().contains(resource1));
+ verify(handler, times(3)).disposeResource(any(Object.class));
+ verify(handler, times(1)).disposeResource(resource1);
+ verify(handler, times(1)).disposeResource(resource2);
+ verify(handler, times(1)).disposeResource(resource3);
verify(resource1, times(1)).isDisposed();
- verify(resource1, never()).dispose();
+ verify(resource1, times(1)).dispose();
verify(resource2, times(1)).isDisposed();
verify(resource2, never()).dispose();
@@ -116,7 +117,7 @@ public class ThemeDefinitionChangedHandlerTest extends TestCase {
// then
verify(engine, never()).reapply();
verify(handler, never()).removeResources(any(IResourcesRegistry.class));
- assertEquals(0, handler.getUnusedResources().size());
+ verify(handler, never()).disposeResource(any(Object.class));
}
public void testHandleEventWhenCSSEngineNotFoundForWidget()
@@ -150,32 +151,7 @@ public class ThemeDefinitionChangedHandlerTest extends TestCase {
// then
verify(engine, times(1)).reapply();
verify(handler, times(1)).removeResources(registry);
- assertEquals(0, handler.getUnusedResources().size());
- }
-
- public void testDisposeHandler() throws Exception {
- // given
- ThemeDefinitionChangedHandlerTestable handler = spy(new ThemeDefinitionChangedHandlerTestable());
-
- Resource resource1 = mock(Resource.class);
- doReturn(false).when(resource1).isDisposed();
- handler.getUnusedResources().add(resource1);
-
- Resource resource2 = mock(Resource.class);
- doReturn(true).when(resource2).isDisposed();
- handler.getUnusedResources().add(resource2);
-
- // when
- handler.dispose();
-
- // then
- assertTrue(handler.getUnusedResources().isEmpty());
-
- verify(resource1, times(1)).isDisposed();
- verify(resource1, times(1)).dispose();
-
- verify(resource2, times(1)).isDisposed();
- verify(resource2, never()).dispose();
+ verify(handler, never()).disposeResource(any(Object.class));
}
protected static class ThemeDefinitionChangedHandlerTestable extends
@@ -192,8 +168,9 @@ public class ThemeDefinitionChangedHandlerTest extends TestCase {
return super.removeResources(registry);
}
- public Set<Resource> getUnusedResources() {
- return unusedResources;
+ @Override
+ public void disposeResource(Object resource) {
+ super.disposeResource(resource);
}
}
} \ No newline at end of file