[Text-UI] Refactor TextStyleManager to interface

Change-Id: Iad653b75174354fcf071149a39e22e01913a09f8
diff --git a/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ecommons/text/ui/presentation/AbstractRuleBasedScanner.java b/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ecommons/text/ui/presentation/AbstractRuleBasedScanner.java
index df02775..6f2dc67 100644
--- a/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ecommons/text/ui/presentation/AbstractRuleBasedScanner.java
+++ b/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ecommons/text/ui/presentation/AbstractRuleBasedScanner.java
@@ -21,12 +21,13 @@
 import org.eclipse.jface.text.rules.IRule;
 import org.eclipse.jface.text.rules.IToken;
 
-import org.eclipse.statet.ecommons.text.ui.settings.TextStyleManager;
+import org.eclipse.statet.jcommons.lang.NonNullByDefault;
 
 
 /**
  * BufferedRuleBasedScanner with managed text styles/tokens.
  */
+@NonNullByDefault
 public abstract class AbstractRuleBasedScanner extends BufferedRuleBasedScanner {
 	
 	
diff --git a/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ecommons/text/ui/presentation/AbstractTextStylesConfigurationBlock.java b/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ecommons/text/ui/presentation/AbstractTextStylesConfigurationBlock.java
index 23ee613..1e0557c 100644
--- a/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ecommons/text/ui/presentation/AbstractTextStylesConfigurationBlock.java
+++ b/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ecommons/text/ui/presentation/AbstractTextStylesConfigurationBlock.java
@@ -85,7 +85,8 @@
 import org.eclipse.statet.ecommons.text.ui.TextViewerEditorColorUpdater;
 import org.eclipse.statet.ecommons.text.ui.TextViewerJFaceUpdater;
 import org.eclipse.statet.ecommons.text.ui.presentation.AbstractTextStylesConfigurationBlock.SyntaxNode.UseStyle;
-import org.eclipse.statet.ecommons.text.ui.settings.TextStyleManager;
+import org.eclipse.statet.ecommons.text.ui.settings.JFaceTextStyleManager;
+import org.eclipse.statet.ecommons.text.ui.settings.PreferenceStoreTextStyleManager;
 import org.eclipse.statet.ecommons.ui.util.LayoutUtils;
 import org.eclipse.statet.ecommons.ui.util.MessageUtils;
 import org.eclipse.statet.ecommons.ui.util.PixelConverter;
@@ -530,7 +531,7 @@
 	private Button strikethroughCheckbox;
 	private Button underlineCheckbox;
 	
-	private TextStyleManager textStyles;
+	private PreferenceStoreTextStyleManager textStyles;
 	
 	protected SourceViewer previewViewer;
 	private SourceEditorViewerConfiguration configuration;
@@ -719,12 +720,12 @@
 	
 	protected SourceEditorViewerConfiguration getSourceViewerConfiguration(
 			final IPreferenceStore preferenceStore) {
-		this.textStyles= new TextStyleManager(preferenceStore, getSettingsGroup());
+		this.textStyles= new JFaceTextStyleManager(preferenceStore, getSettingsGroup());
 		return getSourceEditorViewerConfiguration(preferenceStore, this.textStyles);
 	}
 	
 	protected abstract SourceEditorViewerConfiguration getSourceEditorViewerConfiguration(
-			IPreferenceStore preferenceStore, TextStyleManager textStyles);
+			IPreferenceStore preferenceStore, PreferenceStoreTextStyleManager textStyles);
 	
 	protected abstract IDocumentSetupParticipant getDocumentSetupParticipant();
 	
diff --git a/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ecommons/text/ui/presentation/BasicTextStyleManager.java b/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ecommons/text/ui/presentation/BasicTextStyleManager.java
new file mode 100644
index 0000000..b714947
--- /dev/null
+++ b/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ecommons/text/ui/presentation/BasicTextStyleManager.java
@@ -0,0 +1,62 @@
+/*=============================================================================#
+ # Copyright (c) 2021 Stephan Wahlbrink and others.
+ # 
+ # This program and the accompanying materials are made available under the
+ # terms of the Eclipse Public License 2.0 which is available at
+ # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
+ # which is available at https://www.apache.org/licenses/LICENSE-2.0.
+ # 
+ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
+ # 
+ # Contributors:
+ #     Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
+ #=============================================================================*/
+
+package org.eclipse.statet.ecommons.text.ui.presentation;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.jface.text.rules.IToken;
+import org.eclipse.jface.text.rules.Token;
+
+import org.eclipse.statet.jcommons.lang.NonNullByDefault;
+
+
+@NonNullByDefault
+public abstract class BasicTextStyleManager<TAttributes> implements TextStyleManager {
+	
+	
+	private final Map<String, Token> tokenMap= new HashMap<>();
+	
+	
+	public BasicTextStyleManager() {
+	}
+	
+	
+	/**
+	 * Token access for styles.
+	 * 
+	 * @param key id and prefix for preference keys
+	 * @return token with text style attribute
+	 */
+	@Override
+	public IToken getToken(final String key) {
+		Token token= this.tokenMap.get(key);
+		if (token == null) {
+			token= new Token(createTextAttributes(key));
+			this.tokenMap.put(key, token);
+		}
+		return token;
+	}
+	
+	protected abstract TAttributes createTextAttributes(String key);
+	
+	
+	protected void updateTextStyles() {
+		for (final Map.Entry<String, Token> token : this.tokenMap.entrySet()) {
+			token.getValue().setData(createTextAttributes(token.getKey()));
+		}
+	}
+	
+}
diff --git a/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ecommons/text/ui/presentation/SingleTokenScanner.java b/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ecommons/text/ui/presentation/SingleTokenScanner.java
index ff8d44d..1f244a6 100644
--- a/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ecommons/text/ui/presentation/SingleTokenScanner.java
+++ b/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ecommons/text/ui/presentation/SingleTokenScanner.java
@@ -19,9 +19,10 @@
 import org.eclipse.jface.text.rules.ITokenScanner;
 import org.eclipse.jface.text.rules.Token;
 
-import org.eclipse.statet.ecommons.text.ui.settings.TextStyleManager;
+import org.eclipse.statet.jcommons.lang.NonNullByDefault;
 
 
+@NonNullByDefault
 public class SingleTokenScanner implements ITokenScanner {
 	
 	private static final byte EOF= 0;
diff --git a/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ecommons/text/ui/presentation/TextStyleManager.java b/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ecommons/text/ui/presentation/TextStyleManager.java
new file mode 100644
index 0000000..2b905c0
--- /dev/null
+++ b/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ecommons/text/ui/presentation/TextStyleManager.java
@@ -0,0 +1,35 @@
+/*=============================================================================#
+ # Copyright (c) 2021 Stephan Wahlbrink and others.
+ # 
+ # This program and the accompanying materials are made available under the
+ # terms of the Eclipse Public License 2.0 which is available at
+ # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
+ # which is available at https://www.apache.org/licenses/LICENSE-2.0.
+ # 
+ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
+ # 
+ # Contributors:
+ #     Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
+ #=============================================================================*/
+
+package org.eclipse.statet.ecommons.text.ui.presentation;
+
+import org.eclipse.jface.text.rules.IToken;
+
+import org.eclipse.statet.jcommons.lang.NonNullByDefault;
+
+
+@NonNullByDefault
+public interface TextStyleManager {
+	
+	
+	/**
+	 * Token access for styles.
+	 * 
+	 * @param key id and prefix for preference keys
+	 * @return token with text style attribute
+	 */
+	public IToken getToken(String key);
+	
+	
+}
diff --git a/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ecommons/text/ui/settings/CssTextStyleManager.java b/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ecommons/text/ui/settings/CssTextStyleManager.java
index 2186c49..b7d2331 100644
--- a/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ecommons/text/ui/settings/CssTextStyleManager.java
+++ b/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ecommons/text/ui/settings/CssTextStyleManager.java
@@ -22,10 +22,15 @@
 
 import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.jface.text.rules.IToken;
 import org.eclipse.swt.graphics.RGB;
 
+import org.eclipse.statet.jcommons.lang.NonNullByDefault;
+import org.eclipse.statet.jcommons.lang.Nullable;
 
-public class CssTextStyleManager extends TextStyleManager {
+
+@NonNullByDefault
+public class CssTextStyleManager extends PreferenceStoreTextStyleManager<@Nullable String> {
 	
 	
 	private static void appendCssColor(final StringBuilder sb, final RGB color) {
@@ -59,17 +64,19 @@
 	
 	
 	@Override
-	protected Object createTextAttribute(String key) {
-		if (key != null) {
-			key= resolveUsedKey(key);
-			
-			if (key.equals(this.defaultRootKey)) {
-				return null;
-			}
-		}
-		else {
+	public IToken getToken(@Nullable String key) {
+		if (key == null) {
 			key= this.defaultRootKey;
 		}
+		return super.getToken(key);
+	}
+	
+	@Override
+	protected @Nullable String createTextAttributes(String key) {
+		key= resolveUsedKey(key);
+		if (key.equals(this.defaultRootKey)) {
+			return null;
+		}
 		
 		final StringBuilder sb= new StringBuilder(32);
 		final RGB rgb= PreferenceConverter.getColor(this.preferenceStore, key + TEXTSTYLE_COLOR_SUFFIX);
diff --git a/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ecommons/text/ui/settings/JFaceTextStyleManager.java b/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ecommons/text/ui/settings/JFaceTextStyleManager.java
new file mode 100644
index 0000000..fa7cfe2
--- /dev/null
+++ b/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ecommons/text/ui/settings/JFaceTextStyleManager.java
@@ -0,0 +1,59 @@
+/*=============================================================================#
+ # Copyright (c) 2021 Stephan Wahlbrink and others.
+ # 
+ # This program and the accompanying materials are made available under the
+ # terms of the Eclipse Public License 2.0 which is available at
+ # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
+ # which is available at https://www.apache.org/licenses/LICENSE-2.0.
+ # 
+ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
+ # 
+ # Contributors:
+ #     Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
+ #=============================================================================*/
+
+package org.eclipse.statet.ecommons.text.ui.settings;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.jface.text.TextAttribute;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.RGB;
+
+import org.eclipse.statet.jcommons.lang.NonNullByDefault;
+
+import org.eclipse.statet.ecommons.text.ui.presentation.ITextPresentationConstants;
+
+
+@NonNullByDefault
+public class JFaceTextStyleManager extends PreferenceStoreTextStyleManager<TextAttribute> {
+	
+	
+	public JFaceTextStyleManager(final IPreferenceStore preferenceStore,
+			final String stylesGroupId) {
+		super(preferenceStore, stylesGroupId);
+	}
+	
+	
+	@Override
+	protected TextAttribute createTextAttributes(String key) {
+		key= resolveUsedKey(key);
+		
+		final RGB rgb= PreferenceConverter.getColor(this.preferenceStore, key + ITextPresentationConstants.TEXTSTYLE_COLOR_SUFFIX);
+		int style= this.preferenceStore.getBoolean(key + ITextPresentationConstants.TEXTSTYLE_BOLD_SUFFIX) ?
+				SWT.BOLD : SWT.NORMAL;
+		if (this.preferenceStore.getBoolean(key + ITextPresentationConstants.TEXTSTYLE_ITALIC_SUFFIX)) {
+			style |= SWT.ITALIC;
+		}
+		if (this.preferenceStore.getBoolean(key + ITextPresentationConstants.TEXTSTYLE_UNDERLINE_SUFFIX)) {
+			style |= TextAttribute.UNDERLINE;
+		}
+		if (this.preferenceStore.getBoolean(key + ITextPresentationConstants.TEXTSTYLE_STRIKETHROUGH_SUFFIX)) {
+			style |= TextAttribute.STRIKETHROUGH;
+		}
+		
+		return new TextAttribute(new Color(rgb), null, style);
+	}
+	
+}
diff --git a/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ecommons/text/ui/settings/PreferenceStoreTextStyleManager.java b/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ecommons/text/ui/settings/PreferenceStoreTextStyleManager.java
new file mode 100644
index 0000000..6e96b8d
--- /dev/null
+++ b/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ecommons/text/ui/settings/PreferenceStoreTextStyleManager.java
@@ -0,0 +1,102 @@
+/*=============================================================================#
+ # Copyright (c) 2007, 2021 Stephan Wahlbrink and others.
+ # 
+ # This program and the accompanying materials are made available under the
+ # terms of the Eclipse Public License 2.0 which is available at
+ # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
+ # which is available at https://www.apache.org/licenses/LICENSE-2.0.
+ # 
+ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
+ # 
+ # Contributors:
+ #     Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
+ #=============================================================================*/
+
+package org.eclipse.statet.ecommons.text.ui.settings;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+
+import org.eclipse.statet.jcommons.lang.NonNullByDefault;
+
+import org.eclipse.statet.ecommons.preferences.SettingsChangeNotifier.ManageListener;
+import org.eclipse.statet.ecommons.text.ui.presentation.BasicTextStyleManager;
+import org.eclipse.statet.ecommons.text.ui.presentation.ITextPresentationConstants;
+import org.eclipse.statet.ecommons.ui.util.UIAccess;
+
+
+/**
+ * Manages text style tokens for a highlighting scanner.
+ */
+@NonNullByDefault
+public abstract class PreferenceStoreTextStyleManager<TAttributes> extends BasicTextStyleManager<TAttributes>
+		implements ManageListener {
+	
+	
+	protected final IPreferenceStore preferenceStore;
+	
+	private final String stylesGroupId;
+	
+	
+	public PreferenceStoreTextStyleManager(final IPreferenceStore preferenceStore,
+			final String stylesGroupId) {
+		this.preferenceStore= preferenceStore;
+		this.stylesGroupId= stylesGroupId;
+	}
+	
+	
+	protected String resolveUsedKey(final String key) {
+		String use= key;
+		while (true) {
+			final String test= this.preferenceStore.getString(use+ITextPresentationConstants.TEXTSTYLE_USE_SUFFIX);
+			if (test == null || test.equals("") || test.equals(use)) { //$NON-NLS-1$
+				return use;
+			}
+			use= test;
+		}
+	}
+	
+	/**
+	 * Create a text attribute based on the given color, bold, italic, strikethrough and underline preference keys.
+	 * 
+	 * @param key the key
+	 * @return the created text attribute
+	 * @since 3.0
+	 */
+	@Override
+	protected abstract TAttributes createTextAttributes(String key);
+	
+	
+	public boolean affectsTextPresentation(final Set<String> groupIds) {
+		return (groupIds.contains(this.stylesGroupId));
+	}
+	
+	public void handleSettingsChanged(final Set<String> groupIds, final Map<String, Object> options) {
+		if (affectsTextPresentation(groupIds)) {
+			updateTextStyles();
+			if (options != null) {
+				options.put(ITextPresentationConstants.SETTINGSCHANGE_AFFECTSPRESENTATION_KEY, Boolean.TRUE);
+			}
+		}
+	}
+	
+	
+	@Override
+	public void beforeSettingsChangeNotification(final Set<String> groupIds) {
+		if (affectsTextPresentation(groupIds)) {
+			UIAccess.getDisplay().syncExec(new Runnable() {
+				@Override
+				public void run() {
+					handleSettingsChanged(groupIds, null);
+				}
+			});
+		}
+	}
+	
+	@Override
+	public void afterSettingsChangeNotification(final Set<String> groupIds) {
+	}
+	
+}
diff --git a/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ecommons/text/ui/settings/TextStyleManager.java b/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ecommons/text/ui/settings/TextStyleManager.java
deleted file mode 100644
index befc0af..0000000
--- a/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ecommons/text/ui/settings/TextStyleManager.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*=============================================================================#
- # Copyright (c) 2007, 2021 Stephan Wahlbrink and others.
- # 
- # This program and the accompanying materials are made available under the
- # terms of the Eclipse Public License 2.0 which is available at
- # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
- # which is available at https://www.apache.org/licenses/LICENSE-2.0.
- # 
- # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
- # 
- # Contributors:
- #     Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
- #=============================================================================*/
-
-package org.eclipse.statet.ecommons.text.ui.settings;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.jface.text.TextAttribute;
-import org.eclipse.jface.text.rules.IToken;
-import org.eclipse.jface.text.rules.Token;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.RGB;
-
-import org.eclipse.statet.ecommons.preferences.SettingsChangeNotifier.ManageListener;
-import org.eclipse.statet.ecommons.text.ui.presentation.ITextPresentationConstants;
-import org.eclipse.statet.ecommons.ui.util.UIAccess;
-
-
-/**
- * Manages text style tokens for a highlighting scanner.
- */
-public class TextStyleManager implements ManageListener {
-	
-	
-	protected IPreferenceStore preferenceStore;
-	protected String[] tokenNames;
-	private final String stylesGroupId;
-	
-	private final Map<String, Token> tokenMap= new HashMap<>();
-	
-	
-	public TextStyleManager(final IPreferenceStore preferenceStore,
-			final String stylesGroupId) {
-		super();
-		this.preferenceStore= preferenceStore;
-		this.stylesGroupId= stylesGroupId;
-	}
-	
-	
-	/**
-	 * Token access for styles.
-	 * 
-	 * @param key id and prefix for preference keys
-	 * @return token with text style attribute
-	 */
-	public IToken getToken(final String key) {
-		Token token= this.tokenMap.get(key);
-		if (token == null) {
-			token= new Token(createTextAttribute(key));
-			this.tokenMap.put(key, token);
-		}
-		return token;
-	}
-	
-	protected String resolveUsedKey(final String key) {
-		String use= key;
-		while (true) {
-			final String test= this.preferenceStore.getString(use+ITextPresentationConstants.TEXTSTYLE_USE_SUFFIX);
-			if (test == null || test.equals("") || test.equals(use)) { //$NON-NLS-1$
-				return use;
-			}
-			use= test;
-		}
-	}
-	
-	/**
-	 * Create a text attribute based on the given color, bold, italic, strikethrough and underline preference keys.
-	 * 
-	 * @param rootKey the italic preference key
-	 * @return the created text attribute
-	 * @since 3.0
-	 */
-	protected Object createTextAttribute(String rootKey) {
-		rootKey= resolveUsedKey(rootKey);
-		
-		final RGB rgb= PreferenceConverter.getColor(this.preferenceStore, rootKey + ITextPresentationConstants.TEXTSTYLE_COLOR_SUFFIX);
-		int style= this.preferenceStore.getBoolean(rootKey + ITextPresentationConstants.TEXTSTYLE_BOLD_SUFFIX) ?
-				SWT.BOLD : SWT.NORMAL;
-		if (this.preferenceStore.getBoolean(rootKey + ITextPresentationConstants.TEXTSTYLE_ITALIC_SUFFIX)) {
-			style |= SWT.ITALIC;
-		}
-		if (this.preferenceStore.getBoolean(rootKey + ITextPresentationConstants.TEXTSTYLE_UNDERLINE_SUFFIX)) {
-			style |= TextAttribute.UNDERLINE;
-		}
-		if (this.preferenceStore.getBoolean(rootKey + ITextPresentationConstants.TEXTSTYLE_STRIKETHROUGH_SUFFIX)) {
-			style |= TextAttribute.STRIKETHROUGH;
-		}
-		
-		return new TextAttribute(new Color(rgb), null, style);
-	}
-	
-	public boolean affectsTextPresentation(final Set<String> groupIds) {
-		return (groupIds.contains(this.stylesGroupId));
-	}
-	
-	public void handleSettingsChanged(final Set<String> groupIds, final Map<String, Object> options) {
-		if (affectsTextPresentation(groupIds)) {
-			for (final Map.Entry<String, Token> token : this.tokenMap.entrySet()) {
-				token.getValue().setData(createTextAttribute(token.getKey()));
-			}
-			if (options != null) {
-				options.put(ITextPresentationConstants.SETTINGSCHANGE_AFFECTSPRESENTATION_KEY, Boolean.TRUE);
-			}
-		}
-	}
-	
-	
-	@Override
-	public void beforeSettingsChangeNotification(final Set<String> groupIds) {
-		if (affectsTextPresentation(groupIds)) {
-			UIAccess.getDisplay().syncExec(new Runnable() {
-				@Override
-				public void run() {
-					handleSettingsChanged(groupIds, null);
-				}
-			});
-		}
-	}
-	
-	@Override
-	public void afterSettingsChangeNotification(final Set<String> groupIds) {
-	}
-	
-}
diff --git a/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ltk/ui/sourceediting/SourceEditorViewerConfiguration.java b/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ltk/ui/sourceediting/SourceEditorViewerConfiguration.java
index 1e405d0..ee59a02 100644
--- a/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ltk/ui/sourceediting/SourceEditorViewerConfiguration.java
+++ b/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ltk/ui/sourceediting/SourceEditorViewerConfiguration.java
@@ -75,8 +75,9 @@
 import org.eclipse.statet.ecommons.text.core.sections.DocContentSections;
 import org.eclipse.statet.ecommons.text.ui.DefaultBrowserInformationInput;
 import org.eclipse.statet.ecommons.text.ui.presentation.ITextPresentationConstants;
+import org.eclipse.statet.ecommons.text.ui.presentation.TextStyleManager;
 import org.eclipse.statet.ecommons.text.ui.settings.DecorationPreferences;
-import org.eclipse.statet.ecommons.text.ui.settings.TextStyleManager;
+import org.eclipse.statet.ecommons.text.ui.settings.PreferenceStoreTextStyleManager;
 import org.eclipse.statet.ecommons.ui.ISettingsChangedHandler;
 import org.eclipse.statet.ecommons.ui.dialogs.DialogUtils;
 import org.eclipse.statet.ecommons.ui.util.InformationDispatchHandler;
@@ -172,7 +173,7 @@
 	
 	private final SourceEditor editor;
 	
-	private TextStyleManager textStyles;
+	private PreferenceStoreTextStyleManager textStyles;
 	private final CopyOnWriteIdentityListSet<ISettingsChangedHandler> settingsHandler= new CopyOnWriteIdentityListSet<>();
 	
 	private Map<String, ITokenScanner> scanners;
@@ -217,7 +218,7 @@
 	protected void initTextStyles() {
 	}
 	
-	protected void setTextStyles(final TextStyleManager textStyles) {
+	protected void setTextStyles(final PreferenceStoreTextStyleManager textStyles) {
 		this.textStyles= textStyles;
 	}