diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorColoringConfigurationBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorColoringConfigurationBlock.java index 8d20dd24596..e044ef074c3 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorColoringConfigurationBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorColoringConfigurationBlock.java @@ -23,6 +23,7 @@ import org.eclipse.jface.layout.PixelConverter; import org.eclipse.jface.preference.ColorSelector; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.PreferenceConverter; +import org.eclipse.jface.preference.PreferenceStore; import org.eclipse.jface.resource.JFaceResources; import org.eclipse.jface.text.Document; import org.eclipse.jface.text.IDocument; @@ -62,6 +63,7 @@ import org.eclipse.ui.texteditor.ChainedPreferenceStore; import com.ibm.icu.text.Collator; +import org.eclipse.cdt.core.CCorePreferenceConstants; import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.cdt.ui.PreferenceConstants; import org.eclipse.cdt.ui.text.ICPartitions; @@ -816,7 +818,16 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock { private Control createPreviewer(Composite parent) { IPreferenceStore generalTextStore= EditorsUI.getPreferenceStore(); - IPreferenceStore store= new ChainedPreferenceStore(new IPreferenceStore[] { getPreferenceStore(), generalTextStore }); + // Task tags can have their own coloring, and to demonstrate this, the preview code + // contains a "TODO" task tag. In order for the comment scanner to recognize this + // as a task tag and apply the coloring, "TODO" needs to be present under the + // TODO_TASK_TAGS preference key. Normally this is contained in the core preference + // store, but since the user can override the set of task tags, we provide a custom + // preference store that always has "TODO" under that key. + IPreferenceStore taskTagPreferenceStore= new PreferenceStore(); + taskTagPreferenceStore.setValue(CCorePreferenceConstants.TODO_TASK_TAGS, "TODO"); //$NON-NLS-1$ + IPreferenceStore store= new ChainedPreferenceStore(new IPreferenceStore[] { getPreferenceStore(), + taskTagPreferenceStore, generalTextStore }); fPreviewViewer = new CSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER, store); SimpleCSourceViewerConfiguration configuration = new SimpleCSourceViewerConfiguration(fColorManager, store, null, ICPartitions.C_PARTITIONING, false); fPreviewViewer.configure(configuration); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/ColorSettingPreviewCode.txt b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/ColorSettingPreviewCode.txt index cad8fc42caf..d563238f06f 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/ColorSettingPreviewCode.txt +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/ColorSettingPreviewCode.txt @@ -10,6 +10,7 @@ int static myfunc(uint parameter) { return parameter - 1; } void mutator(int&); +template class MyClass { public: enum Number { ZERO, ONE, TWO }; @@ -21,7 +22,7 @@ public: label: myfunc(local); vmethod(); staticMethod(); - problem(); + problem(); // TODO: fix mutator(local); } static void staticMethod();