Bug 468796 - ClassCastException in Theme$1.propertyChange (127)
Theme Property Change Listener is made to process values either of type FontData[] or String for fonts and
either of type RGB or String for colours. So it could process the typed values as well as their String representations.
Change-Id: I4c99f66fded977d3489c16a1164c25673efe3ec2
Signed-off-by: vrubezhny <vrubezhny@exadel.com>
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/Theme.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/Theme.java
index 1358697..a66a4ee 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/Theme.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/Theme.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2011 IBM Corporation and others.
+ * Copyright (c) 2004, 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
@@ -12,7 +12,6 @@
import java.util.ResourceBundle;
import java.util.Set;
-
import org.eclipse.core.commands.common.EventManager;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
@@ -120,17 +119,19 @@
if (Util.equals(thisTheme, theme)) {
if (getFontRegistry().hasValueFor(key)) {
- FontData[] data = PreferenceConverter
- .basicGetFontData((String) event
- .getNewValue());
+ FontData[] data = event.getNewValue() instanceof String
+ ? PreferenceConverter.basicGetFontData((String) event.getNewValue())
+ : (FontData[]) event.getNewValue();
getFontRegistry().put(key, data);
processDefaultsTo(key, data);
return;
}
else if (getColorRegistry().hasValueFor(key)) {
- RGB rgb = StringConverter.asRGB((String) event
- .getNewValue());
+ RGB rgb = event.getNewValue() instanceof String
+ ? StringConverter.asRGB((String) event.getNewValue())
+ : (RGB) event.getNewValue();
+
getColorRegistry().put(key, rgb);
processDefaultsTo(key, rgb);
return;