summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabriel Pascual2014-05-16 10:26:35 (EDT)
committerGabriel Pascual2014-05-16 10:26:35 (EDT)
commit041e62ff4f5644bf88b6fe593a5a08d91940a4bb (patch)
treebab52524cd24e272f1680d1e5664e861f6d7880f
parent9c54f2800f63b1b2e41eefda8a8fef1410b65dec (diff)
downloadorg.eclipse.papyrus-041e62ff4f5644bf88b6fe593a5a08d91940a4bb.zip
org.eclipse.papyrus-041e62ff4f5644bf88b6fe593a5a08d91940a4bb.tar.gz
org.eclipse.papyrus-041e62ff4f5644bf88b6fe593a5a08d91940a4bb.tar.bz2
434956: [CSS] Exception in CSS Preference pagerefs/changes/37/26737/1
https://bugs.eclipse.org/bugs/show_bug.cgi?id=434956 - Patch Theme manager to avoid NPE Change-Id: Ibe901ae435299f4d9c8be0acbb39eab4b4713fe9 Signed-off-by: Gabriel Pascual <gabriel.pascual@all4tec.net>
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/theme/ThemeManager.java18
1 files changed, 14 insertions, 4 deletions
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/theme/ThemeManager.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/theme/ThemeManager.java
index a01d7fd..24bf4c6 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/theme/ThemeManager.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/theme/ThemeManager.java
@@ -109,14 +109,25 @@ public class ThemeManager {
}
/**
- * Returns the theme associated to the given id, or <code>null</code> if it doesn't
+ * Returns the theme associated to the given id, or {@link EmptyTheme} if it doesn't
* exist
*
* @param themeId
* @return
*/
public Theme getTheme(String themeId) {
- return getAllThemes().get(themeId);
+ Theme registeredTheme = null;
+
+ if(getAllThemes().containsKey(themeId)) {
+ registeredTheme = getAllThemes().get(themeId);
+ }
+
+ // Bug 434956 : Patch to ensure that one theme is returned.
+ if(registeredTheme == null) {
+ registeredTheme = EmptyTheme.instance;
+ }
+
+ return registeredTheme;
}
/**
@@ -477,8 +488,7 @@ public class ThemeManager {
if(store.contains(ThemePreferences.CURRENT_THEME)) {
String themeId = store.getString(ThemePreferences.CURRENT_THEME);
- Theme theme = getAllThemes().containsKey(themeId) ? getAllThemes().get(themeId) : EmptyTheme.instance;
- return theme;
+ return getTheme(themeId);
}
//The theme has not been defined: return the first one, and store it