Bug 574391: Make extending TextViewerEditorColorUpdater.update simpler

Change-Id: I208306fc512b7d1d72d94a43c840d247ebd7884b
diff --git a/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ecommons/text/ui/TextViewerEditorColorUpdater.java b/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ecommons/text/ui/TextViewerEditorColorUpdater.java
index de5dcf8..30b2e3a 100644
--- a/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ecommons/text/ui/TextViewerEditorColorUpdater.java
+++ b/ltk/org.eclipse.statet.ltk.ui/src/org/eclipse/statet/ecommons/text/ui/TextViewerEditorColorUpdater.java
@@ -87,32 +87,37 @@
 	
 	
 	protected void updateColors() {
-		final StyledText styledText= this.viewer.getTextWidget();
-		if (UIAccess.isOkToUse(styledText)) {
-			{	// foreground color
-				final Color color= this.preferenceStore.getBoolean(
-						PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT) ? null :
-								createColor(this.preferenceStore, PREFERENCE_COLOR_FOREGROUND);
-				styledText.setForeground(color);
-			}
-			{	// background color
-				final Color color= this.preferenceStore.getBoolean(
-						PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT) ? null :
-								createColor(this.preferenceStore, PREFERENCE_COLOR_BACKGROUND);
-				styledText.setBackground(color);
-			}
-			{	// selection foreground color
-				final Color color= this.preferenceStore.getBoolean(
-						PREFERENCE_COLOR_SELECTION_FOREGROUND_SYSTEM_DEFAULT) ? null :
-								createColor(this.preferenceStore, PREFERENCE_COLOR_SELECTION_FOREGROUND);
-				styledText.setSelectionForeground(color);
-			}
-			{	// selection background color
-				final Color color= this.preferenceStore.getBoolean(
-						PREFERENCE_COLOR_SELECTION_BACKGROUND_SYSTEM_DEFAULT) ? null :
-								createColor(this.preferenceStore, PREFERENCE_COLOR_SELECTION_BACKGROUND);
-				styledText.setSelectionBackground(color);
-			}
+		final var viewer= this.viewer;
+		final StyledText styledText= viewer.getTextWidget();
+		if (styledText != null && !styledText.isDisposed()) {
+			update(viewer, styledText);
+		}
+	}
+	
+	protected void update(final ISourceViewer viewer, final StyledText styledText) {
+		{	// foreground color
+			final Color color= this.preferenceStore.getBoolean(
+					PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT) ? null :
+							createColor(this.preferenceStore, PREFERENCE_COLOR_FOREGROUND);
+			styledText.setForeground(color);
+		}
+		{	// background color
+			final Color color= this.preferenceStore.getBoolean(
+					PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT) ? null :
+							createColor(this.preferenceStore, PREFERENCE_COLOR_BACKGROUND);
+			styledText.setBackground(color);
+		}
+		{	// selection foreground color
+			final Color color= this.preferenceStore.getBoolean(
+					PREFERENCE_COLOR_SELECTION_FOREGROUND_SYSTEM_DEFAULT) ? null :
+							createColor(this.preferenceStore, PREFERENCE_COLOR_SELECTION_FOREGROUND);
+			styledText.setSelectionForeground(color);
+		}
+		{	// selection background color
+			final Color color= this.preferenceStore.getBoolean(
+					PREFERENCE_COLOR_SELECTION_BACKGROUND_SYSTEM_DEFAULT) ? null :
+							createColor(this.preferenceStore, PREFERENCE_COLOR_SELECTION_BACKGROUND);
+			styledText.setSelectionBackground(color);
 		}
 	}