aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Rolka2013-12-11 04:55:32 (EST)
committerGerrit Code Review @ Eclipse.org2013-12-11 11:00:22 (EST)
commit05044a55787792abee37f4adaef63c63198bbae5 (patch)
tree6e6297c9c6ff09118563ace91397716d908cbc38
parent75ffbc303c1e30c1a1741e193ffc33aedbd9eecd (diff)
downloadeclipse.platform.ui-05044a55787792abee37f4adaef63c63198bbae5.zip
eclipse.platform.ui-05044a55787792abee37f4adaef63c63198bbae5.tar.gz
eclipse.platform.ui-05044a55787792abee37f4adaef63c63198bbae5.tar.bz2
Bug 423768 - [CSS] IAE exception when switching between CSS stylesheetsrefs/changes/33/19633/2
with combo Change-Id: I60c65cbeabfccb22bdb1b129144a5adbdcc0e56e Signed-off-by: Daniel Rolka <daniel.rolka@pl.ibm.com>
-rw-r--r--bundles/org.eclipse.e4.ui.css.swt.theme/src/org/eclipse/e4/ui/css/swt/internal/theme/ThemeEngine.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/bundles/org.eclipse.e4.ui.css.swt.theme/src/org/eclipse/e4/ui/css/swt/internal/theme/ThemeEngine.java b/bundles/org.eclipse.e4.ui.css.swt.theme/src/org/eclipse/e4/ui/css/swt/internal/theme/ThemeEngine.java
index 5d3297d..407d23d 100644
--- a/bundles/org.eclipse.e4.ui.css.swt.theme/src/org/eclipse/e4/ui/css/swt/internal/theme/ThemeEngine.java
+++ b/bundles/org.eclipse.e4.ui.css.swt.theme/src/org/eclipse/e4/ui/css/swt/internal/theme/ThemeEngine.java
@@ -39,12 +39,18 @@ import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.e4.ui.css.core.engine.CSSElementContext;
import org.eclipse.e4.ui.css.core.engine.CSSEngine;
+import org.eclipse.e4.ui.css.core.resources.IResourcesRegistry;
import org.eclipse.e4.ui.css.core.util.impl.resources.FileResourcesLocatorImpl;
import org.eclipse.e4.ui.css.core.util.impl.resources.OSGiResourceLocator;
import org.eclipse.e4.ui.css.core.util.resources.IResourceLocator;
+import org.eclipse.e4.ui.css.swt.resources.SWTResourcesRegistry;
import org.eclipse.e4.ui.css.swt.theme.ITheme;
import org.eclipse.e4.ui.css.swt.theme.IThemeEngine;
import org.eclipse.osgi.service.datalocation.Location;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -397,6 +403,7 @@ public class ThemeEngine implements IThemeEngine {
this.currentTheme = theme;
for (CSSEngine engine : cssEngines) {
+ removeSWTResourceFromCache(engine.getResourcesRegistry());
engine.reset();
}
@@ -459,6 +466,15 @@ public class ThemeEngine implements IThemeEngine {
sendThemeChangeEvent(restore);
}
+ @SuppressWarnings("restriction")
+ private void removeSWTResourceFromCache(IResourcesRegistry registry) {
+ if (registry instanceof SWTResourcesRegistry) {
+ ((SWTResourcesRegistry) registry)
+ .removeResourcesByKeyTypeAndType(Object.class, Font.class,
+ Color.class, Image.class, Cursor.class);
+ }
+ }
+
/**
* Broadcast theme-change event using OSGi Event Admin.
*/