1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 367403 - [preferences] C/C++ editor does not respect high contrast settings

This commit is contained in:
Anton Leherbauer 2011-12-22 16:39:38 +01:00
parent cfb47f9a65
commit adc46fe221
11 changed files with 1100 additions and 379 deletions

View file

@ -577,6 +577,258 @@
label="%Dummy.label" label="%Dummy.label"
value="240, 216, 168"> value="240, 216, 168">
</colorDefinition> </colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.c_multi_line_comment"
isEditable="false"
label="%Dummy.label"
value="63, 127, 95">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.c_single_line_comment"
isEditable="false"
label="%Dummy.label"
value="63, 127, 95">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.c_keyword"
isEditable="false"
label="%Dummy.label"
value="127, 0, 85">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.c_type"
isEditable="false"
label="%Dummy.label"
value="127, 0, 85">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.c_string"
isEditable="false"
label="%Dummy.label"
value="42, 0, 255">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.c_operators"
isEditable="false"
label="%Dummy.label"
value="0, 0, 0">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.c_braces"
isEditable="false"
label="%Dummy.label"
value="0, 0, 0">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.c_numbers"
isEditable="false"
label="%Dummy.label"
value="0, 0, 0">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.c_default"
isEditable="false"
label="%Dummy.label"
value="0, 0, 0">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.pp_directive"
isEditable="false"
label="%Dummy.label"
value="127, 0, 85">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.pp_directive"
isEditable="false"
label="%Dummy.label"
value="127, 0, 85">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.pp_default"
isEditable="false"
label="%Dummy.label"
value="0, 0, 0">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.pp_header"
isEditable="false"
label="%Dummy.label"
value="42, 0, 255">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.asm_directive"
isEditable="false"
label="%Dummy.label"
value="127, 0, 85">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.asm_label"
isEditable="false"
label="%Dummy.label"
value="127, 0, 85">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.c_comment_task_tag"
isEditable="false"
label="%Dummy.label"
value="127, 159, 191">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.internal.ui.text.doctools.doxygen.multi"
isEditable="false"
label="%Dummy.label"
value="63, 95, 191">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.internal.ui.text.doctools.doxygen.single"
isEditable="false"
label="%Dummy.label"
value="63, 95, 191">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.internal.ui.text.doctools.doxygen.recognizedTag"
isEditable="false"
label="%Dummy.label"
value="127, 159, 191">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.staticFieldHighlighting"
isEditable="false"
label="%Dummy.label"
value="0, 0, 192">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.fieldHighlighting"
isEditable="false"
label="%Dummy.label"
value="0, 0, 192">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.methodDeclarationHighlighting"
isEditable="false"
label="%Dummy.label"
value="0, 0, 0">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.staticMethodHighlighting"
isEditable="false"
label="%Dummy.label"
value="0, 0, 0">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.functionDeclarationHighlighting"
isEditable="false"
label="%Dummy.label"
value="0, 0, 0">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.functionHighlighting"
isEditable="false"
label="%Dummy.label"
value="0, 0, 0">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.localVariableDeclarationHighlighting"
isEditable="false"
label="%Dummy.label"
value="128, 0, 0">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.localVariableHighlighting"
isEditable="false"
label="%Dummy.label"
value="0, 0, 0">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.globalVariableHighlighting"
isEditable="false"
label="%Dummy.label"
value="0, 0, 0">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.parameterVariableHighlighting"
isEditable="false"
label="%Dummy.label"
value="0, 0, 0">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.templateParameterHighlighting"
isEditable="false"
label="%Dummy.label"
value="100, 70, 50">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.methodHighlighting"
isEditable="false"
label="%Dummy.label"
value="0, 0, 0">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.classHighlighting"
isEditable="false"
label="%Dummy.label"
value="0, 80, 50">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.enumHighlighting"
isEditable="false"
label="%Dummy.label"
value="100, 70, 50">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.macroSubstitutionHighlighting"
isEditable="false"
label="%Dummy.label"
value="0, 0, 0">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.macroDefinitionHighlighting"
isEditable="false"
label="%Dummy.label"
value="0, 0, 0">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.typedefHighlighting"
isEditable="false"
label="%Dummy.label"
value="0, 80, 50">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.namespaceHighlighting"
isEditable="false"
label="%Dummy.label"
value="0, 0, 0">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.labelHighlighting"
isEditable="false"
label="%Dummy.label"
value="0, 0, 0">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.enumeratorHighlighting"
isEditable="false"
label="%Dummy.label"
value="0, 0, 192">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.problemHighlighting"
isEditable="false"
label="%Dummy.label"
value="224, 0, 0">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.externalSDKHighlighting"
isEditable="false"
label="%Dummy.label"
value="100, 40, 128">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.overloadedOperatorHighlighting"
isEditable="false"
label="%Dummy.label"
value="200, 100, 0">
</colorDefinition>
<theme <theme
id="org.eclipse.ui.ide.systemDefault"> id="org.eclipse.ui.ide.systemDefault">
<colorOverride <colorOverride
@ -595,6 +847,170 @@
id="org.eclipse.cdt.ui.content_assist_parameters_foreground" id="org.eclipse.cdt.ui.content_assist_parameters_foreground"
value="COLOR_LIST_FOREGROUND"> value="COLOR_LIST_FOREGROUND">
</colorOverride> </colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.c_multi_line_comment"
value="COLOR_LIST_SELECTION">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.c_single_line_comment"
value="COLOR_LIST_SELECTION">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.c_keyword"
value="COLOR_LIST_FOREGROUND">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.c_type"
value="COLOR_LIST_FOREGROUND">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.c_string"
value="COLOR_LIST_FOREGROUND">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.c_operators"
value="COLOR_LIST_FOREGROUND">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.c_braces"
value="COLOR_LIST_FOREGROUND">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.c_numbers"
value="COLOR_LIST_FOREGROUND">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.c_default"
value="COLOR_LIST_FOREGROUND">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.pp_directive"
value="COLOR_LIST_FOREGROUND">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.pp_default"
value="COLOR_LIST_FOREGROUND">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.pp_header"
value="COLOR_LIST_FOREGROUND">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.asm_directive"
value="COLOR_LIST_FOREGROUND">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.asm_label"
value="COLOR_LIST_FOREGROUND">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.c_comment_task_tag"
value="COLOR_WIDGET_NORMAL_SHADOW">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.internal.ui.text.doctools.doxygen.multi"
value="COLOR_LIST_SELECTION">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.internal.ui.text.doctools.doxygen.single"
value="COLOR_LIST_SELECTION">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.internal.ui.text.doctools.doxygen.recognizedTag"
value="COLOR_WIDGET_NORMAL_SHADOW">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.staticFieldHighlighting"
value="COLOR_LIST_SELECTION">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.fieldHighlighting"
value="COLOR_LIST_SELECTION">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.methodDeclarationHighlighting"
value="COLOR_LIST_FOREGROUND">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.staticMethodHighlighting"
value="COLOR_LIST_FOREGROUND">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.functionDeclarationHighlighting"
value="COLOR_LIST_FOREGROUND">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.functionHighlighting"
value="COLOR_LIST_FOREGROUND">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.localVariableDeclarationHighlighting"
value="COLOR_LIST_FOREGROUND">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.localVariableHighlighting"
value="COLOR_LIST_FOREGROUND">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.globalVariableHighlighting"
value="COLOR_LIST_FOREGROUND">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.parameterVariableHighlighting"
value="COLOR_LIST_FOREGROUND">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.templateParameterHighlighting"
value="COLOR_WIDGET_DARK_SHADOW">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.methodHighlighting"
value="COLOR_LIST_FOREGROUND">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.classHighlighting"
value="COLOR_WIDGET_DARK_SHADOW">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.enumHighlighting"
value="COLOR_WIDGET_DARK_SHADOW">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.macroSubstitutionHighlighting"
value="COLOR_LIST_FOREGROUND">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.macroDefinitionHighlighting"
value="COLOR_LIST_FOREGROUND">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.typedefHighlighting"
value="COLOR_LIST_FOREGROUND">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.namespaceHighlighting"
value="COLOR_LIST_FOREGROUND">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.labelHighlighting"
value="COLOR_LIST_FOREGROUND">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.enumeratorHighlighting"
value="COLOR_LIST_FOREGROUND">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.problemHighlighting"
value="COLOR_WIDGET_DARK_SHADOW">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.externalSDKHighlighting"
value="COLOR_LIST_FOREGROUND">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.overloadedOperatorHighlighting"
value="COLOR_LIST_FOREGROUND">
</colorOverride>
</theme> </theme>
</extension> </extension>
@ -2946,10 +3362,6 @@
point="org.eclipse.core.runtime.preferences"> point="org.eclipse.core.runtime.preferences">
<initializer class="org.eclipse.cdt.ui.CUIPreferenceInitializer"/> <initializer class="org.eclipse.cdt.ui.CUIPreferenceInitializer"/>
</extension> </extension>
<extension
point="org.eclipse.core.runtime.preferences">
<initializer class="org.eclipse.cdt.ui.text.doctools.doxygen.DoxygenHelper"/>
</extension>
<!-- Default folding --> <!-- Default folding -->
<extension <extension

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007 IBM Corporation and others. * Copyright (c) 2007, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -40,4 +40,94 @@ public interface ICThemeConstants {
*/ */
public final String CODEASSIST_PARAMETERS_FOREGROUND= ID_PREFIX + PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND; public final String CODEASSIST_PARAMETERS_FOREGROUND= ID_PREFIX + PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND;
/**
* A theme constant that holds the foreground color used for multi-line comments.
*/
public final String EDITOR_MULTI_LINE_COMMENT_COLOR= ID_PREFIX + PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_COLOR;
/**
* A theme constant that holds the foreground color used for single-line comments.
*/
public final String EDITOR_SINGLE_LINE_COMMENT_COLOR= ID_PREFIX + PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_COLOR;
/**
* A theme constant that holds the foreground color used for C/C++ keywords.
*/
public final String EDITOR_C_KEYWORD_COLOR= ID_PREFIX + PreferenceConstants.EDITOR_C_KEYWORD_COLOR;
/**
* A theme constant that holds the foreground color used for preprocessor directives.
*/
public final String EDITOR_PP_DIRECTIVE_COLOR= ID_PREFIX + PreferenceConstants.EDITOR_PP_DIRECTIVE_COLOR;
/**
* A theme constant that holds the foreground color used for preprocessor headers (includes).
*/
public final String EDITOR_PP_HEADER_COLOR= ID_PREFIX + PreferenceConstants.EDITOR_PP_HEADER_COLOR;
/**
* A theme constant that holds the foreground color used for preprocessor text.
*/
public final String EDITOR_PP_DEFAULT_COLOR= ID_PREFIX + PreferenceConstants.EDITOR_PP_DEFAULT_COLOR;
/**
* A theme constant that holds the foreground color used for C/C++ built-in types.
*/
public final String EDITOR_C_BUILTIN_TYPE_COLOR= ID_PREFIX + PreferenceConstants.EDITOR_C_BUILTIN_TYPE_COLOR;
/**
* A theme constant that holds the foreground color used for string constants.
*/
public final String EDITOR_C_STRING_COLOR= ID_PREFIX + PreferenceConstants.EDITOR_C_STRING_COLOR;
/**
* A theme constant that holds the foreground color used for operators.
*/
public final String EDITOR_C_OPERATOR_COLOR= ID_PREFIX + PreferenceConstants.EDITOR_C_OPERATOR_COLOR;
/**
* A theme constant that holds the foreground color used for numbers.
*/
public final String EDITOR_C_NUMBER_COLOR= ID_PREFIX + PreferenceConstants.EDITOR_C_NUMBER_COLOR;
/**
* A theme constant that holds the foreground color used for braces.
*/
public final String EDITOR_C_BRACES_COLOR= ID_PREFIX + PreferenceConstants.EDITOR_C_BRACES_COLOR;
/**
* A theme constant that holds the foreground color used for C/C++ code.
*/
public final String EDITOR_C_DEFAULT_COLOR= ID_PREFIX + PreferenceConstants.EDITOR_C_DEFAULT_COLOR;
/**
* A theme constant that holds the foreground color used for assembly labels.
*/
public final String EDITOR_ASM_LABEL_COLOR= ID_PREFIX + PreferenceConstants.EDITOR_ASM_LABEL_COLOR;
/**
* A theme constant that holds the foreground color used for assembly directives.
*/
public final String EDITOR_ASM_DIRECTIVE_COLOR= ID_PREFIX + PreferenceConstants.EDITOR_ASM_DIRECTIVE_COLOR;
/**
* A theme constant that holds the foreground color used for task tags.
*/
public final String EDITOR_TASK_TAG_COLOR= ID_PREFIX + PreferenceConstants.EDITOR_TASK_TAG_COLOR;
/**
* A theme constant that holds the foreground color used for doxygen multi-line comments.
*/
public final String DOXYGEN_MULTI_LINE_COLOR= PreferenceConstants.DOXYGEN_MULTI_LINE_COLOR;
/**
* A theme constant that holds the foreground color used for doxygen single line comments.
*/
public final String DOXYGEN_SINGLE_LINE_COLOR= PreferenceConstants.DOXYGEN_SINGLE_LINE_COLOR;
/**
* A theme constant that holds the foreground color used for doxygen tags.
*/
public final String DOXYGEN_TAG_COLOR= PreferenceConstants.DOXYGEN_TAG_COLOR;
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2000, 2009 IBM Corporation and others. * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -13,7 +13,11 @@
package org.eclipse.cdt.internal.ui.editor; package org.eclipse.cdt.internal.ui.editor;
import org.eclipse.jface.resource.ColorRegistry;
import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.graphics.RGB;
import org.eclipse.ui.PlatformUI;
import org.eclipse.cdt.ui.CUIPlugin;
/** /**
* Semantic highlighting. * Semantic highlighting.
@ -28,11 +32,17 @@ public abstract class SemanticHighlighting {
*/ */
public abstract String getPreferenceKey(); public abstract String getPreferenceKey();
/**
* @return the default default text color
* @since 5.4
*/
public abstract RGB getDefaultDefaultTextColor();
/** /**
* @return the default text color * @return the default text color
*/ */
public RGB getDefaultTextColor() { public RGB getDefaultTextColor() {
return new RGB(0, 0, 0); return findRGB(getThemeColorKey(), getDefaultDefaultTextColor());
} }
/** /**
@ -93,4 +103,28 @@ public abstract class SemanticHighlighting {
* @return <code>true</code> iff the semantic highlighting consumes the semantic token * @return <code>true</code> iff the semantic highlighting consumes the semantic token
*/ */
public abstract boolean consumes(SemanticToken token); public abstract boolean consumes(SemanticToken token);
private String getThemeColorKey() {
return CUIPlugin.PLUGIN_ID + "." + getPreferenceKey() + "Highlighting"; //$NON-NLS-1$//$NON-NLS-2$
}
/**
* Returns the RGB for the given key in the given color registry.
*
* @param key the key for the constant in the registry
* @param defaultRGB the default RGB if no entry is found
* @return RGB the RGB
* @since 5.4
*/
private static RGB findRGB(String key, RGB defaultRGB) {
if (!PlatformUI.isWorkbenchRunning())
return defaultRGB;
ColorRegistry registry= PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry();
RGB rgb= registry.getRGB(key);
if (rgb != null)
return rgb;
return defaultRGB;
}
} }

View file

@ -64,7 +64,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.OverloadableOperator;
/** /**
* Semantic highlightings. * Semantic highlightings.
* Derived from JDT. * Derived from JDT.
* *
* @since 4.0 * @since 4.0
*/ */
public class SemanticHighlightings { public class SemanticHighlightings {
@ -135,12 +135,12 @@ public class SemanticHighlightings {
* A named preference part that controls the highlighting of classes. * A named preference part that controls the highlighting of classes.
*/ */
public static final String CLASS="class"; //$NON-NLS-1$ public static final String CLASS="class"; //$NON-NLS-1$
/** /**
* A named preference part that controls the highlighting of enums. * A named preference part that controls the highlighting of enums.
*/ */
public static final String ENUM="enum"; //$NON-NLS-1$ public static final String ENUM="enum"; //$NON-NLS-1$
/** /**
* A named preference part that controls the highlighting of macro references. * A named preference part that controls the highlighting of macro references.
*/ */
@ -180,16 +180,16 @@ public class SemanticHighlightings {
* A named preference part that controls the highlighting of external SDK. * A named preference part that controls the highlighting of external SDK.
*/ */
public static final String EXTERNAL_SDK="externalSDK"; //$NON-NLS-1$ public static final String EXTERNAL_SDK="externalSDK"; //$NON-NLS-1$
/** /**
* A named preference part that controls the highlighting of operators that have been overloaded. * A named preference part that controls the highlighting of operators that have been overloaded.
*/ */
public static final String OVERLOADED_OPERATOR="overloadedOperator"; //$NON-NLS-1$ public static final String OVERLOADED_OPERATOR="overloadedOperator"; //$NON-NLS-1$
/** Init debugging mode */ /** Init debugging mode */
private static final boolean DEBUG= "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.cdt.ui/debug/SemanticHighlighting")); //$NON-NLS-1$//$NON-NLS-2$ private static final boolean DEBUG= "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.cdt.ui/debug/SemanticHighlighting")); //$NON-NLS-1$//$NON-NLS-2$
/** /**
* Semantic highlightings * Semantic highlightings
*/ */
@ -209,10 +209,10 @@ public class SemanticHighlightings {
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextColor() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
*/ */
@Override @Override
public RGB getDefaultTextColor() { public RGB getDefaultDefaultTextColor() {
return new RGB(0, 0, 192); return new RGB(0, 0, 192);
} }
@ -245,7 +245,7 @@ public class SemanticHighlightings {
*/ */
@Override @Override
public String getDisplayName() { public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_staticField; return CEditorMessages.SemanticHighlighting_staticField;
} }
/* /*
@ -282,10 +282,10 @@ public class SemanticHighlightings {
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextColor() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
*/ */
@Override @Override
public RGB getDefaultTextColor() { public RGB getDefaultDefaultTextColor() {
return new RGB(0, 0, 192); return new RGB(0, 0, 192);
} }
@ -318,7 +318,7 @@ public class SemanticHighlightings {
*/ */
@Override @Override
public String getDisplayName() { public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_field; return CEditorMessages.SemanticHighlighting_field;
} }
/* /*
@ -355,10 +355,10 @@ public class SemanticHighlightings {
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextColor() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
*/ */
@Override @Override
public RGB getDefaultTextColor() { public RGB getDefaultDefaultTextColor() {
return RGB_BLACK; return RGB_BLACK;
} }
@ -391,7 +391,7 @@ public class SemanticHighlightings {
*/ */
@Override @Override
public String getDisplayName() { public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_methodDeclaration; return CEditorMessages.SemanticHighlighting_methodDeclaration;
} }
/* /*
@ -454,10 +454,10 @@ public class SemanticHighlightings {
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextColor() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
*/ */
@Override @Override
public RGB getDefaultTextColor() { public RGB getDefaultDefaultTextColor() {
return RGB_BLACK; return RGB_BLACK;
} }
@ -490,7 +490,7 @@ public class SemanticHighlightings {
*/ */
@Override @Override
public String getDisplayName() { public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_staticMethodInvocation; return CEditorMessages.SemanticHighlighting_staticMethodInvocation;
} }
/* /*
@ -530,10 +530,10 @@ public class SemanticHighlightings {
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextColor() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
*/ */
@Override @Override
public RGB getDefaultTextColor() { public RGB getDefaultDefaultTextColor() {
return RGB_BLACK; return RGB_BLACK;
} }
@ -566,7 +566,7 @@ public class SemanticHighlightings {
*/ */
@Override @Override
public String getDisplayName() { public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_method; return CEditorMessages.SemanticHighlighting_method;
} }
/* /*
@ -606,10 +606,10 @@ public class SemanticHighlightings {
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextColor() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
*/ */
@Override @Override
public RGB getDefaultTextColor() { public RGB getDefaultDefaultTextColor() {
return RGB_BLACK; return RGB_BLACK;
} }
@ -642,7 +642,7 @@ public class SemanticHighlightings {
*/ */
@Override @Override
public String getDisplayName() { public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_functionDeclaration; return CEditorMessages.SemanticHighlighting_functionDeclaration;
} }
/* /*
@ -658,7 +658,7 @@ public class SemanticHighlightings {
IASTName name= (IASTName)node; IASTName name= (IASTName)node;
if (name.isDeclaration()) { if (name.isDeclaration()) {
IBinding binding= token.getBinding(); IBinding binding= token.getBinding();
if (binding instanceof IFunction if (binding instanceof IFunction
&& !(binding instanceof ICPPMethod)) { && !(binding instanceof ICPPMethod)) {
return true; return true;
} else if (binding instanceof IProblemBinding) { } else if (binding instanceof IProblemBinding) {
@ -700,10 +700,10 @@ public class SemanticHighlightings {
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextColor() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
*/ */
@Override @Override
public RGB getDefaultTextColor() { public RGB getDefaultDefaultTextColor() {
return RGB_BLACK; return RGB_BLACK;
} }
@ -736,7 +736,7 @@ public class SemanticHighlightings {
*/ */
@Override @Override
public String getDisplayName() { public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_function; return CEditorMessages.SemanticHighlighting_function;
} }
/* /*
@ -760,7 +760,7 @@ public class SemanticHighlightings {
return false; return false;
} }
} }
/** /**
* Semantic highlighting for local variable declarations. * Semantic highlighting for local variable declarations.
*/ */
@ -775,10 +775,10 @@ public class SemanticHighlightings {
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextColor() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
*/ */
@Override @Override
public RGB getDefaultTextColor() { public RGB getDefaultDefaultTextColor() {
return new RGB(128, 0, 0); return new RGB(128, 0, 0);
} }
@ -811,7 +811,7 @@ public class SemanticHighlightings {
*/ */
@Override @Override
public String getDisplayName() { public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_localVariableDeclaration; return CEditorMessages.SemanticHighlighting_localVariableDeclaration;
} }
/* /*
@ -835,7 +835,7 @@ public class SemanticHighlightings {
} }
} catch (DOMException exc) { } catch (DOMException exc) {
CUIPlugin.log(exc); CUIPlugin.log(exc);
} }
} }
} }
} }
@ -858,10 +858,10 @@ public class SemanticHighlightings {
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextColor() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
*/ */
@Override @Override
public RGB getDefaultTextColor() { public RGB getDefaultDefaultTextColor() {
return RGB_BLACK; return RGB_BLACK;
} }
@ -894,7 +894,7 @@ public class SemanticHighlightings {
*/ */
@Override @Override
public String getDisplayName() { public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_localVariable; return CEditorMessages.SemanticHighlighting_localVariable;
} }
/* /*
@ -918,7 +918,7 @@ public class SemanticHighlightings {
} }
} catch (DOMException exc) { } catch (DOMException exc) {
CUIPlugin.log(exc); CUIPlugin.log(exc);
} }
} }
} }
} }
@ -956,10 +956,10 @@ public class SemanticHighlightings {
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextColor() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
*/ */
@Override @Override
public RGB getDefaultTextColor() { public RGB getDefaultDefaultTextColor() {
return RGB_BLACK; return RGB_BLACK;
} }
@ -992,7 +992,7 @@ public class SemanticHighlightings {
*/ */
@Override @Override
public String getDisplayName() { public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_globalVariable; return CEditorMessages.SemanticHighlighting_globalVariable;
} }
/* /*
@ -1019,12 +1019,12 @@ public class SemanticHighlightings {
} }
} catch (DOMException exc) { } catch (DOMException exc) {
CUIPlugin.log(exc); CUIPlugin.log(exc);
} }
} }
} }
return false; return false;
} }
} }
/** /**
@ -1041,10 +1041,10 @@ public class SemanticHighlightings {
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextColor() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
*/ */
@Override @Override
public RGB getDefaultTextColor() { public RGB getDefaultDefaultTextColor() {
return RGB_BLACK; return RGB_BLACK;
} }
@ -1077,7 +1077,7 @@ public class SemanticHighlightings {
*/ */
@Override @Override
public String getDisplayName() { public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_parameterVariable; return CEditorMessages.SemanticHighlighting_parameterVariable;
} }
/* /*
@ -1107,10 +1107,10 @@ public class SemanticHighlightings {
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextColor() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
*/ */
@Override @Override
public RGB getDefaultTextColor() { public RGB getDefaultDefaultTextColor() {
return new RGB(100, 70, 50); return new RGB(100, 70, 50);
} }
@ -1143,7 +1143,7 @@ public class SemanticHighlightings {
*/ */
@Override @Override
public String getDisplayName() { public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_templateParameter; return CEditorMessages.SemanticHighlighting_templateParameter;
} }
/* /*
@ -1161,7 +1161,7 @@ public class SemanticHighlightings {
return false; return false;
} }
} }
/** /**
* Semantic highlighting for classes. * Semantic highlighting for classes.
*/ */
@ -1176,10 +1176,10 @@ public class SemanticHighlightings {
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextColor() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
*/ */
@Override @Override
public RGB getDefaultTextColor() { public RGB getDefaultDefaultTextColor() {
return new RGB(0, 80, 50); return new RGB(0, 80, 50);
} }
@ -1212,7 +1212,7 @@ public class SemanticHighlightings {
*/ */
@Override @Override
public String getDisplayName() { public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_classes; return CEditorMessages.SemanticHighlighting_classes;
} }
/* /*
@ -1238,7 +1238,7 @@ public class SemanticHighlightings {
* Semantic highlighting for enums. * Semantic highlighting for enums.
*/ */
private static final class EnumHighlighting extends SemanticHighlighting { private static final class EnumHighlighting extends SemanticHighlighting {
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
*/ */
@ -1246,15 +1246,15 @@ public class SemanticHighlightings {
public String getPreferenceKey() { public String getPreferenceKey() {
return ENUM; return ENUM;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextColor() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
*/ */
@Override @Override
public RGB getDefaultTextColor() { public RGB getDefaultDefaultTextColor() {
return new RGB(100, 70, 50); return new RGB(100, 70, 50);
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
*/ */
@ -1262,7 +1262,7 @@ public class SemanticHighlightings {
public boolean isBoldByDefault() { public boolean isBoldByDefault() {
return false; return false;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
*/ */
@ -1270,7 +1270,7 @@ public class SemanticHighlightings {
public boolean isItalicByDefault() { public boolean isItalicByDefault() {
return false; return false;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
*/ */
@ -1278,15 +1278,15 @@ public class SemanticHighlightings {
public boolean isEnabledByDefault() { public boolean isEnabledByDefault() {
return false; return false;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
*/ */
@Override @Override
public String getDisplayName() { public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_enums; return CEditorMessages.SemanticHighlighting_enums;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken) * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
*/ */
@ -1302,12 +1302,12 @@ public class SemanticHighlightings {
return false; return false;
} }
} }
/** /**
* Semantic highlighting for macro references. * Semantic highlighting for macro references.
*/ */
private static final class MacroReferenceHighlighting extends SemanticHighlighting { private static final class MacroReferenceHighlighting extends SemanticHighlighting {
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
*/ */
@ -1315,15 +1315,15 @@ public class SemanticHighlightings {
public String getPreferenceKey() { public String getPreferenceKey() {
return MACRO_REFERENCE; return MACRO_REFERENCE;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextColor() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
*/ */
@Override @Override
public RGB getDefaultTextColor() { public RGB getDefaultDefaultTextColor() {
return RGB_BLACK; return RGB_BLACK;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
*/ */
@ -1331,7 +1331,7 @@ public class SemanticHighlightings {
public boolean isBoldByDefault() { public boolean isBoldByDefault() {
return false; return false;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
*/ */
@ -1339,7 +1339,7 @@ public class SemanticHighlightings {
public boolean isItalicByDefault() { public boolean isItalicByDefault() {
return false; return false;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
*/ */
@ -1347,15 +1347,15 @@ public class SemanticHighlightings {
public boolean isEnabledByDefault() { public boolean isEnabledByDefault() {
return false; return false;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
*/ */
@Override @Override
public String getDisplayName() { public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_macroSubstitution; return CEditorMessages.SemanticHighlighting_macroSubstitution;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken) * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
*/ */
@ -1371,12 +1371,12 @@ public class SemanticHighlightings {
return false; return false;
} }
} }
/** /**
* Semantic highlighting for macro definitions. * Semantic highlighting for macro definitions.
*/ */
private static final class MacroDefinitionHighlighting extends SemanticHighlighting { private static final class MacroDefinitionHighlighting extends SemanticHighlighting {
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
*/ */
@ -1384,15 +1384,15 @@ public class SemanticHighlightings {
public String getPreferenceKey() { public String getPreferenceKey() {
return MACRO_DEFINITION; return MACRO_DEFINITION;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextColor() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
*/ */
@Override @Override
public RGB getDefaultTextColor() { public RGB getDefaultDefaultTextColor() {
return RGB_BLACK; return RGB_BLACK;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
*/ */
@ -1400,7 +1400,7 @@ public class SemanticHighlightings {
public boolean isBoldByDefault() { public boolean isBoldByDefault() {
return false; return false;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
*/ */
@ -1408,7 +1408,7 @@ public class SemanticHighlightings {
public boolean isItalicByDefault() { public boolean isItalicByDefault() {
return false; return false;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
*/ */
@ -1416,15 +1416,15 @@ public class SemanticHighlightings {
public boolean isEnabledByDefault() { public boolean isEnabledByDefault() {
return false; return false;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
*/ */
@Override @Override
public String getDisplayName() { public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_macroDefintion; return CEditorMessages.SemanticHighlighting_macroDefintion;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken) * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
*/ */
@ -1440,12 +1440,12 @@ public class SemanticHighlightings {
return false; return false;
} }
} }
/** /**
* Semantic highlighting for typedefs. * Semantic highlighting for typedefs.
*/ */
private static final class TypedefHighlighting extends SemanticHighlighting { private static final class TypedefHighlighting extends SemanticHighlighting {
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
*/ */
@ -1453,15 +1453,15 @@ public class SemanticHighlightings {
public String getPreferenceKey() { public String getPreferenceKey() {
return TYPEDEF; return TYPEDEF;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextColor() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
*/ */
@Override @Override
public RGB getDefaultTextColor() { public RGB getDefaultDefaultTextColor() {
return new RGB(0, 80, 50); return new RGB(0, 80, 50);
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
*/ */
@ -1469,7 +1469,7 @@ public class SemanticHighlightings {
public boolean isBoldByDefault() { public boolean isBoldByDefault() {
return false; return false;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
*/ */
@ -1477,7 +1477,7 @@ public class SemanticHighlightings {
public boolean isItalicByDefault() { public boolean isItalicByDefault() {
return false; return false;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
*/ */
@ -1485,15 +1485,15 @@ public class SemanticHighlightings {
public boolean isEnabledByDefault() { public boolean isEnabledByDefault() {
return true; return true;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
*/ */
@Override @Override
public String getDisplayName() { public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_typeDef; return CEditorMessages.SemanticHighlighting_typeDef;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken) * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
*/ */
@ -1513,12 +1513,12 @@ public class SemanticHighlightings {
return false; return false;
} }
} }
/** /**
* Semantic highlighting for namespaces. * Semantic highlighting for namespaces.
*/ */
private static final class NamespaceHighlighting extends SemanticHighlighting { private static final class NamespaceHighlighting extends SemanticHighlighting {
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
*/ */
@ -1526,15 +1526,15 @@ public class SemanticHighlightings {
public String getPreferenceKey() { public String getPreferenceKey() {
return NAMESPACE; return NAMESPACE;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextColor() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
*/ */
@Override @Override
public RGB getDefaultTextColor() { public RGB getDefaultDefaultTextColor() {
return RGB_BLACK; return RGB_BLACK;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
*/ */
@ -1542,7 +1542,7 @@ public class SemanticHighlightings {
public boolean isBoldByDefault() { public boolean isBoldByDefault() {
return false; return false;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
*/ */
@ -1550,7 +1550,7 @@ public class SemanticHighlightings {
public boolean isItalicByDefault() { public boolean isItalicByDefault() {
return false; return false;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
*/ */
@ -1558,15 +1558,15 @@ public class SemanticHighlightings {
public boolean isEnabledByDefault() { public boolean isEnabledByDefault() {
return false; return false;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
*/ */
@Override @Override
public String getDisplayName() { public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_namespace; return CEditorMessages.SemanticHighlighting_namespace;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken) * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
*/ */
@ -1579,12 +1579,12 @@ public class SemanticHighlightings {
return false; return false;
} }
} }
/** /**
* Semantic highlighting for labels. * Semantic highlighting for labels.
*/ */
private static final class LabelHighlighting extends SemanticHighlighting { private static final class LabelHighlighting extends SemanticHighlighting {
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
*/ */
@ -1592,15 +1592,15 @@ public class SemanticHighlightings {
public String getPreferenceKey() { public String getPreferenceKey() {
return LABEL; return LABEL;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextColor() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
*/ */
@Override @Override
public RGB getDefaultTextColor() { public RGB getDefaultDefaultTextColor() {
return RGB_BLACK; return RGB_BLACK;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
*/ */
@ -1608,7 +1608,7 @@ public class SemanticHighlightings {
public boolean isBoldByDefault() { public boolean isBoldByDefault() {
return false; return false;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
*/ */
@ -1616,7 +1616,7 @@ public class SemanticHighlightings {
public boolean isItalicByDefault() { public boolean isItalicByDefault() {
return false; return false;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
*/ */
@ -1624,15 +1624,15 @@ public class SemanticHighlightings {
public boolean isEnabledByDefault() { public boolean isEnabledByDefault() {
return false; return false;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
*/ */
@Override @Override
public String getDisplayName() { public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_label; return CEditorMessages.SemanticHighlighting_label;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken) * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
*/ */
@ -1645,12 +1645,12 @@ public class SemanticHighlightings {
return false; return false;
} }
} }
/** /**
* Semantic highlighting for enumerators. * Semantic highlighting for enumerators.
*/ */
private static final class EnumeratorHighlighting extends SemanticHighlighting { private static final class EnumeratorHighlighting extends SemanticHighlighting {
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
*/ */
@ -1658,15 +1658,15 @@ public class SemanticHighlightings {
public String getPreferenceKey() { public String getPreferenceKey() {
return ENUMERATOR; return ENUMERATOR;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextColor() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
*/ */
@Override @Override
public RGB getDefaultTextColor() { public RGB getDefaultDefaultTextColor() {
return new RGB(0, 0, 192); return new RGB(0, 0, 192);
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
*/ */
@ -1674,7 +1674,7 @@ public class SemanticHighlightings {
public boolean isBoldByDefault() { public boolean isBoldByDefault() {
return false; return false;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
*/ */
@ -1682,7 +1682,7 @@ public class SemanticHighlightings {
public boolean isItalicByDefault() { public boolean isItalicByDefault() {
return true; return true;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
*/ */
@ -1690,15 +1690,15 @@ public class SemanticHighlightings {
public boolean isEnabledByDefault() { public boolean isEnabledByDefault() {
return true; return true;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
*/ */
@Override @Override
public String getDisplayName() { public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_enumerator; return CEditorMessages.SemanticHighlighting_enumerator;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken) * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
*/ */
@ -1718,12 +1718,12 @@ public class SemanticHighlightings {
return false; return false;
} }
} }
/** /**
* Semantic highlighting for problems. * Semantic highlighting for problems.
*/ */
private static final class ProblemHighlighting extends SemanticHighlighting { private static final class ProblemHighlighting extends SemanticHighlighting {
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
*/ */
@ -1731,15 +1731,15 @@ public class SemanticHighlightings {
public String getPreferenceKey() { public String getPreferenceKey() {
return PROBLEM; return PROBLEM;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextColor() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
*/ */
@Override @Override
public RGB getDefaultTextColor() { public RGB getDefaultDefaultTextColor() {
return new RGB(224, 0, 0); return new RGB(224, 0, 0);
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
*/ */
@ -1747,7 +1747,7 @@ public class SemanticHighlightings {
public boolean isBoldByDefault() { public boolean isBoldByDefault() {
return true; return true;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isStrikethroughByDefault() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isStrikethroughByDefault()
*/ */
@ -1763,7 +1763,7 @@ public class SemanticHighlightings {
public boolean isItalicByDefault() { public boolean isItalicByDefault() {
return false; return false;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
*/ */
@ -1771,15 +1771,15 @@ public class SemanticHighlightings {
public boolean isEnabledByDefault() { public boolean isEnabledByDefault() {
return false; return false;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
*/ */
@Override @Override
public String getDisplayName() { public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_problem; return CEditorMessages.SemanticHighlighting_problem;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken) * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
*/ */
@ -1796,12 +1796,12 @@ public class SemanticHighlightings {
return false; return false;
} }
} }
/** /**
* Semantic highlighting for external SDK references. * Semantic highlighting for external SDK references.
*/ */
private static final class ExternalSDKHighlighting extends SemanticHighlighting { private static final class ExternalSDKHighlighting extends SemanticHighlighting {
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
*/ */
@ -1809,15 +1809,15 @@ public class SemanticHighlightings {
public String getPreferenceKey() { public String getPreferenceKey() {
return EXTERNAL_SDK; return EXTERNAL_SDK;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextColor() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
*/ */
@Override @Override
public RGB getDefaultTextColor() { public RGB getDefaultDefaultTextColor() {
return new RGB(100, 40, 128); return new RGB(100, 40, 128);
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
*/ */
@ -1825,7 +1825,7 @@ public class SemanticHighlightings {
public boolean isBoldByDefault() { public boolean isBoldByDefault() {
return true; return true;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isStrikethroughByDefault() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isStrikethroughByDefault()
*/ */
@ -1841,7 +1841,7 @@ public class SemanticHighlightings {
public boolean isItalicByDefault() { public boolean isItalicByDefault() {
return false; return false;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
*/ */
@ -1849,15 +1849,15 @@ public class SemanticHighlightings {
public boolean isEnabledByDefault() { public boolean isEnabledByDefault() {
return true; return true;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
*/ */
@Override @Override
public String getDisplayName() { public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_externalSDK; return CEditorMessages.SemanticHighlighting_externalSDK;
} }
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken) * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
*/ */
@ -1910,7 +1910,7 @@ public class SemanticHighlightings {
return false; return false;
} }
} }
/** /**
* Semantic highlighting for functions. * Semantic highlighting for functions.
*/ */
@ -1924,7 +1924,7 @@ public class SemanticHighlightings {
return OVERLOADED_OPERATOR; return OVERLOADED_OPERATOR;
} }
@Override @Override
public boolean requiresImplicitNames() { public boolean requiresImplicitNames() {
return true; return true;
@ -1932,10 +1932,10 @@ public class SemanticHighlightings {
/* /*
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextColor() * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultDefaultTextColor()
*/ */
@Override @Override
public RGB getDefaultTextColor() { public RGB getDefaultDefaultTextColor() {
return new RGB(200, 100, 0); // orange return new RGB(200, 100, 0); // orange
} }
@ -1968,7 +1968,7 @@ public class SemanticHighlightings {
*/ */
@Override @Override
public String getDisplayName() { public String getDisplayName() {
return CEditorMessages.SemanticHighlighting_overloadedOperators; return CEditorMessages.SemanticHighlighting_overloadedOperators;
} }
/* /*
@ -1999,7 +1999,7 @@ public class SemanticHighlightings {
return false; return false;
} }
} }
/** /**
* A named preference that controls the given semantic highlighting's color. * A named preference that controls the given semantic highlighting's color.
* *

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2000, 2010 IBM Corporation and others. * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -66,7 +66,6 @@ import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.ui.PreferenceConstants; import org.eclipse.cdt.ui.PreferenceConstants;
import org.eclipse.cdt.ui.text.ICPartitions; import org.eclipse.cdt.ui.text.ICPartitions;
import org.eclipse.cdt.ui.text.IColorManager; import org.eclipse.cdt.ui.text.IColorManager;
import org.eclipse.cdt.ui.text.doctools.doxygen.DoxygenHelper;
import org.eclipse.cdt.internal.ui.editor.CSourceViewer; import org.eclipse.cdt.internal.ui.editor.CSourceViewer;
import org.eclipse.cdt.internal.ui.editor.SemanticHighlighting; import org.eclipse.cdt.internal.ui.editor.SemanticHighlighting;
@ -206,6 +205,7 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
/* /*
* @see org.eclipse.jface.viewers.IColorProvider#getBackground(java.lang.Object) * @see org.eclipse.jface.viewers.IColorProvider#getBackground(java.lang.Object)
*/ */
@Override
public Color getBackground(Object element) { public Color getBackground(Object element) {
return null; return null;
} }
@ -213,6 +213,7 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
/* /*
* @see org.eclipse.jface.viewers.IColorProvider#getForeground(java.lang.Object) * @see org.eclipse.jface.viewers.IColorProvider#getForeground(java.lang.Object)
*/ */
@Override
public Color getForeground(Object element) { public Color getForeground(Object element) {
if (element instanceof SemanticHighlightingColorListItem) { if (element instanceof SemanticHighlightingColorListItem) {
if (!getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_ENABLED)) { if (!getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_ENABLED)) {
@ -231,6 +232,7 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
/* /*
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
*/ */
@Override
public Object[] getElements(Object inputElement) { public Object[] getElements(Object inputElement) {
return new String[] {fCodeCategory, fAssemblyCategory, fCommentsCategory, fPreprocessorCategory, fDoxygenCategory}; return new String[] {fCodeCategory, fAssemblyCategory, fCommentsCategory, fPreprocessorCategory, fDoxygenCategory};
} }
@ -238,15 +240,18 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
/* /*
* @see org.eclipse.jface.viewers.IContentProvider#dispose() * @see org.eclipse.jface.viewers.IContentProvider#dispose()
*/ */
@Override
public void dispose() { public void dispose() {
} }
/* /*
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/ */
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
} }
@Override
public Object[] getChildren(Object parentElement) { public Object[] getChildren(Object parentElement) {
if (parentElement instanceof String) { if (parentElement instanceof String) {
String entry= (String) parentElement; String entry= (String) parentElement;
@ -264,6 +269,7 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
return new Object[0]; return new Object[0];
} }
@Override
public Object getParent(Object element) { public Object getParent(Object element) {
if (element instanceof String) if (element instanceof String)
return null; return null;
@ -279,6 +285,7 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
return fCommentsCategory; return fCommentsCategory;
} }
@Override
public boolean hasChildren(Object element) { public boolean hasChildren(Object element) {
return element instanceof String; return element instanceof String;
} }
@ -313,9 +320,9 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
{ PreferencesMessages.CEditorColoringConfigurationBlock_ppHeaders, PreferenceConstants.EDITOR_PP_HEADER_COLOR }, { PreferencesMessages.CEditorColoringConfigurationBlock_ppHeaders, PreferenceConstants.EDITOR_PP_HEADER_COLOR },
{ PreferencesMessages.CEditorColoringConfigurationBlock_asmLabels, PreferenceConstants.EDITOR_ASM_LABEL_COLOR }, { PreferencesMessages.CEditorColoringConfigurationBlock_asmLabels, PreferenceConstants.EDITOR_ASM_LABEL_COLOR },
{ PreferencesMessages.CEditorColoringConfigurationBlock_asmDirectives, PreferenceConstants.EDITOR_ASM_DIRECTIVE_COLOR }, { PreferencesMessages.CEditorColoringConfigurationBlock_asmDirectives, PreferenceConstants.EDITOR_ASM_DIRECTIVE_COLOR },
{ PreferencesMessages.CEditorColoringConfigurationBlock_DoxygenTagRecognized, DoxygenHelper.DOXYGEN_TAG_RECOGNIZED }, { PreferencesMessages.CEditorColoringConfigurationBlock_DoxygenTagRecognized, PreferenceConstants.DOXYGEN_TAG_COLOR },
{ PreferencesMessages.CEditorColoringConfigurationBlock_DoxygenSingleLineComment, DoxygenHelper.DOXYGEN_SINGLE_TOKEN }, { PreferencesMessages.CEditorColoringConfigurationBlock_DoxygenSingleLineComment, PreferenceConstants.DOXYGEN_SINGLE_LINE_COLOR },
{ PreferencesMessages.CEditorColoringConfigurationBlock_DoxygenMultiLineComment, DoxygenHelper.DOXYGEN_MULTI_TOKEN }, { PreferencesMessages.CEditorColoringConfigurationBlock_DoxygenMultiLineComment, PreferenceConstants.DOXYGEN_MULTI_LINE_COLOR },
{ PreferencesMessages.CEditorColoringConfigurationBlock_keywords, PreferenceConstants.EDITOR_C_KEYWORD_COLOR }, { PreferencesMessages.CEditorColoringConfigurationBlock_keywords, PreferenceConstants.EDITOR_C_KEYWORD_COLOR },
// { PreferencesMessages.CEditorColoringConfigurationBlock_returnKeyword, PreferenceConstants.EDITOR_C_KEYWORD_RETURN_COLOR }, // { PreferencesMessages.CEditorColoringConfigurationBlock_returnKeyword, PreferenceConstants.EDITOR_C_KEYWORD_RETURN_COLOR },
{ PreferencesMessages.CEditorColoringConfigurationBlock_builtInTypes, PreferenceConstants.EDITOR_C_BUILTIN_TYPE_COLOR }, { PreferencesMessages.CEditorColoringConfigurationBlock_builtInTypes, PreferenceConstants.EDITOR_C_BUILTIN_TYPE_COLOR },
@ -432,6 +439,7 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
* @param parent the parent composite * @param parent the parent composite
* @return the control for the preference page * @return the control for the preference page
*/ */
@Override
public Control createControl(Composite parent) { public Control createControl(Composite parent) {
initializeDialogUnits(parent); initializeDialogUnits(parent);
return createSyntaxPage(parent); return createSyntaxPage(parent);
@ -698,15 +706,18 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
previewer.setLayoutData(gd); previewer.setLayoutData(gd);
fListViewer.addSelectionChangedListener(new ISelectionChangedListener() { fListViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) { public void selectionChanged(SelectionChangedEvent event) {
handleSyntaxColorListSelection(); handleSyntaxColorListSelection();
} }
}); });
foregroundColorButton.addSelectionListener(new SelectionListener() { foregroundColorButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) { public void widgetDefaultSelected(SelectionEvent e) {
// do nothing // do nothing
} }
@Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
HighlightingColorListItem item= getHighlightingColorListItem(); HighlightingColorListItem item= getHighlightingColorListItem();
PreferenceConverter.setValue(getPreferenceStore(), item.getColorKey(), fSyntaxForegroundColorEditor.getColorValue()); PreferenceConverter.setValue(getPreferenceStore(), item.getColorKey(), fSyntaxForegroundColorEditor.getColorValue());
@ -714,9 +725,11 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
}); });
fBoldCheckBox.addSelectionListener(new SelectionListener() { fBoldCheckBox.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) { public void widgetDefaultSelected(SelectionEvent e) {
// do nothing // do nothing
} }
@Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
HighlightingColorListItem item= getHighlightingColorListItem(); HighlightingColorListItem item= getHighlightingColorListItem();
getPreferenceStore().setValue(item.getBoldKey(), fBoldCheckBox.getSelection()); getPreferenceStore().setValue(item.getBoldKey(), fBoldCheckBox.getSelection());
@ -724,18 +737,22 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
}); });
fItalicCheckBox.addSelectionListener(new SelectionListener() { fItalicCheckBox.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) { public void widgetDefaultSelected(SelectionEvent e) {
// do nothing // do nothing
} }
@Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
HighlightingColorListItem item= getHighlightingColorListItem(); HighlightingColorListItem item= getHighlightingColorListItem();
getPreferenceStore().setValue(item.getItalicKey(), fItalicCheckBox.getSelection()); getPreferenceStore().setValue(item.getItalicKey(), fItalicCheckBox.getSelection());
} }
}); });
fStrikethroughCheckBox.addSelectionListener(new SelectionListener() { fStrikethroughCheckBox.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) { public void widgetDefaultSelected(SelectionEvent e) {
// do nothing // do nothing
} }
@Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
HighlightingColorListItem item= getHighlightingColorListItem(); HighlightingColorListItem item= getHighlightingColorListItem();
getPreferenceStore().setValue(item.getStrikethroughKey(), fStrikethroughCheckBox.getSelection()); getPreferenceStore().setValue(item.getStrikethroughKey(), fStrikethroughCheckBox.getSelection());
@ -743,9 +760,11 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
}); });
fUnderlineCheckBox.addSelectionListener(new SelectionListener() { fUnderlineCheckBox.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) { public void widgetDefaultSelected(SelectionEvent e) {
// do nothing // do nothing
} }
@Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
HighlightingColorListItem item= getHighlightingColorListItem(); HighlightingColorListItem item= getHighlightingColorListItem();
getPreferenceStore().setValue(item.getUnderlineKey(), fUnderlineCheckBox.getSelection()); getPreferenceStore().setValue(item.getUnderlineKey(), fUnderlineCheckBox.getSelection());
@ -753,9 +772,11 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
}); });
fEnableCheckbox.addSelectionListener(new SelectionListener() { fEnableCheckbox.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) { public void widgetDefaultSelected(SelectionEvent e) {
// do nothing // do nothing
} }
@Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
HighlightingColorListItem item= getHighlightingColorListItem(); HighlightingColorListItem item= getHighlightingColorListItem();
if (item instanceof SemanticHighlightingColorListItem) { if (item instanceof SemanticHighlightingColorListItem) {
@ -775,9 +796,11 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
}); });
fEnableSemanticHighlightingCheckbox.addSelectionListener(new SelectionListener() { fEnableSemanticHighlightingCheckbox.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) { public void widgetDefaultSelected(SelectionEvent e) {
// do nothing // do nothing
} }
@Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
fListViewer.refresh(true); fListViewer.refresh(true);
HighlightingColorListItem item= getHighlightingColorListItem(); HighlightingColorListItem item= getHighlightingColorListItem();

View file

@ -48,6 +48,8 @@ import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.source.ISharedTextColors; import org.eclipse.jface.text.source.ISharedTextColors;
import org.eclipse.jface.text.templates.ContextTypeRegistry; import org.eclipse.jface.text.templates.ContextTypeRegistry;
import org.eclipse.jface.text.templates.persistence.TemplateStore; import org.eclipse.jface.text.templates.persistence.TemplateStore;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorInput;
@ -56,6 +58,7 @@ import org.eclipse.ui.IEditorReference;
import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.editors.text.EditorsUI; import org.eclipse.ui.editors.text.EditorsUI;
import org.eclipse.ui.editors.text.templates.ContributionContextTypeRegistry; import org.eclipse.ui.editors.text.templates.ContributionContextTypeRegistry;
import org.eclipse.ui.editors.text.templates.ContributionTemplateStore; import org.eclipse.ui.editors.text.templates.ContributionTemplateStore;
@ -64,6 +67,7 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.ui.preferences.ScopedPreferenceStore; import org.eclipse.ui.preferences.ScopedPreferenceStore;
import org.eclipse.ui.texteditor.ChainedPreferenceStore; import org.eclipse.ui.texteditor.ChainedPreferenceStore;
import org.eclipse.ui.texteditor.ConfigurationElementSorter; import org.eclipse.ui.texteditor.ConfigurationElementSorter;
import org.eclipse.ui.themes.IThemeManager;
import org.osgi.framework.Bundle; import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext; import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException; import org.osgi.framework.BundleException;
@ -118,11 +122,11 @@ public class CUIPlugin extends AbstractUIPlugin {
public static final String C_PROBLEMMARKER = PLUGIN_CORE_ID + ".problem"; //$NON-NLS-1$ public static final String C_PROBLEMMARKER = PLUGIN_CORE_ID + ".problem"; //$NON-NLS-1$
public static final String ID_COMMENT_OWNER= PLUGIN_ID+".DocCommentOwner"; //$NON-NLS-1$ public static final String ID_COMMENT_OWNER= PLUGIN_ID+".DocCommentOwner"; //$NON-NLS-1$
public static final String ID_INCLUDE_BROWSER= PLUGIN_ID + ".includeBrowser"; //$NON-NLS-1$ public static final String ID_INCLUDE_BROWSER= PLUGIN_ID + ".includeBrowser"; //$NON-NLS-1$
public static final String ID_CALL_HIERARCHY= PLUGIN_ID + ".callHierarchy"; //$NON-NLS-1$ public static final String ID_CALL_HIERARCHY= PLUGIN_ID + ".callHierarchy"; //$NON-NLS-1$
public static final String ID_TYPE_HIERARCHY = PLUGIN_ID + ".typeHierarchy"; //$NON-NLS-1$ public static final String ID_TYPE_HIERARCHY = PLUGIN_ID + ".typeHierarchy"; //$NON-NLS-1$
public static final String C_PROJECT_WIZARD_ID = PLUGIN_ID + ".wizards.StdCWizard"; //$NON-NLS-1$ public static final String C_PROJECT_WIZARD_ID = PLUGIN_ID + ".wizards.StdCWizard"; //$NON-NLS-1$
public static final String CPP_PROJECT_WIZARD_ID = PLUGIN_ID + ".wizards.StdCCWizard"; //$NON-NLS-1$ public static final String CPP_PROJECT_WIZARD_ID = PLUGIN_ID + ".wizards.StdCCWizard"; //$NON-NLS-1$
@ -130,7 +134,7 @@ public class CUIPlugin extends AbstractUIPlugin {
/** @deprecated This wizard category has been merged with the {@link #CWIZARD_CATEGORY_ID c wizard category} */ /** @deprecated This wizard category has been merged with the {@link #CWIZARD_CATEGORY_ID c wizard category} */
@Deprecated @Deprecated
public final static String CCWIZARD_CATEGORY_ID = "org.eclipse.cdt.ui.newCCWizards"; //$NON-NLS-1$ public final static String CCWIZARD_CATEGORY_ID = "org.eclipse.cdt.ui.newCCWizards"; //$NON-NLS-1$
public static final String SEARCH_ACTION_SET_ID = PLUGIN_ID + ".SearchActionSet"; //$NON-NLS-1$ public static final String SEARCH_ACTION_SET_ID = PLUGIN_ID + ".SearchActionSet"; //$NON-NLS-1$
public static final String BUILDER_ID = PLUGIN_CORE_ID + ".cbuilder"; //$NON-NLS-1$ public static final String BUILDER_ID = PLUGIN_CORE_ID + ".cbuilder"; //$NON-NLS-1$
@ -142,22 +146,22 @@ public class CUIPlugin extends AbstractUIPlugin {
/** /**
* The id of the C perspective * The id of the C perspective
* (value <code>"org.eclipse.cdt.ui.CPerspective"</code>). * (value <code>"org.eclipse.cdt.ui.CPerspective"</code>).
*/ */
public static final String ID_CPERSPECTIVE = PLUGIN_ID + ".CPerspective"; //$NON-NLS-1$ public static final String ID_CPERSPECTIVE = PLUGIN_ID + ".CPerspective"; //$NON-NLS-1$
/** /**
* The id of the C hierarchy perspective * The id of the C hierarchy perspective
* (value <code>"org.eclipse.cdt.ui.CHierarchyPerspective"</code>). * (value <code>"org.eclipse.cdt.ui.CHierarchyPerspective"</code>).
* *
* @deprecated This perspective no longer exists. * @deprecated This perspective no longer exists.
*/ */
@Deprecated @Deprecated
public static final String ID_CHIERARCHY_PERSPECTIVE = PLUGIN_ID + ".CHierarchyPerspective"; //$NON-NLS-1$ public static final String ID_CHIERARCHY_PERSPECTIVE = PLUGIN_ID + ".CHierarchyPerspective"; //$NON-NLS-1$
/** /**
* The id of the C Browsing Perspective * The id of the C Browsing Perspective
* (value <code>"org.eclipse.cdt.ui.CBrowsingPerspective"</code>). * (value <code>"org.eclipse.cdt.ui.CBrowsingPerspective"</code>).
* *
* @since 2.0 * @since 2.0
* @deprecated This perspective no longer exists. * @deprecated This perspective no longer exists.
*/ */
@ -167,7 +171,7 @@ public class CUIPlugin extends AbstractUIPlugin {
/** /**
* The view part id of the C Browsing Projects view * The view part id of the C Browsing Projects view
* (value <code>"org.eclipse.cdt.ui.ProjectsView"</code>). * (value <code>"org.eclipse.cdt.ui.ProjectsView"</code>).
* *
* @since 2.0 * @since 2.0
* @deprecated This view no longer exists. * @deprecated This view no longer exists.
* @noreference This field is not intended to be referenced by clients. * @noreference This field is not intended to be referenced by clients.
@ -178,7 +182,7 @@ public class CUIPlugin extends AbstractUIPlugin {
/** /**
* The view part id of the C Browsing Namespaces view * The view part id of the C Browsing Namespaces view
* (value <code>"org.eclipse.cdt.ui.NamespacesView"</code>). * (value <code>"org.eclipse.cdt.ui.NamespacesView"</code>).
* *
* @since 2.0 * @since 2.0
* @deprecated This view no longer exists. * @deprecated This view no longer exists.
* @noreference This field is not intended to be referenced by clients. * @noreference This field is not intended to be referenced by clients.
@ -189,7 +193,7 @@ public class CUIPlugin extends AbstractUIPlugin {
/** /**
* The view part id of the C Browsing Types view * The view part id of the C Browsing Types view
* (value <code>"org.eclipse.cdt.ui.TypesView"</code>). * (value <code>"org.eclipse.cdt.ui.TypesView"</code>).
* *
* @since 2.0 * @since 2.0
* @deprecated This view no longer exists. * @deprecated This view no longer exists.
* @noreference This field is not intended to be referenced by clients. * @noreference This field is not intended to be referenced by clients.
@ -200,7 +204,7 @@ public class CUIPlugin extends AbstractUIPlugin {
/** /**
* The view part id of the C Browsing Members view * The view part id of the C Browsing Members view
* (value <code>"org.eclipse.cdt.ui.MembersView"</code>). * (value <code>"org.eclipse.cdt.ui.MembersView"</code>).
* *
* @since 2.0 * @since 2.0
* @deprecated This view no longer exists. * @deprecated This view no longer exists.
* @noreference This field is not intended to be referenced by clients. * @noreference This field is not intended to be referenced by clients.
@ -209,7 +213,7 @@ public class CUIPlugin extends AbstractUIPlugin {
public static String ID_MEMBERS_VIEW = PLUGIN_ID + ".MembersView"; //$NON-NLS-1$ public static String ID_MEMBERS_VIEW = PLUGIN_ID + ".MembersView"; //$NON-NLS-1$
/** /**
* The key to store customized templates. * The key to store customized templates.
* @since 3.0 * @since 3.0
*/ */
private static final String CUSTOM_TEMPLATES_KEY= "org.eclipse.cdt.ui.text.templates.custom"; //$NON-NLS-1$ private static final String CUSTOM_TEMPLATES_KEY= "org.eclipse.cdt.ui.text.templates.custom"; //$NON-NLS-1$
@ -217,20 +221,20 @@ public class CUIPlugin extends AbstractUIPlugin {
/** /**
* The id of the C Element Creation action set * The id of the C Element Creation action set
* (value <code>"org.eclipse.cdt.ui.CElementCreationActionSet"</code>). * (value <code>"org.eclipse.cdt.ui.CElementCreationActionSet"</code>).
* *
* @since 2.0 * @since 2.0
*/ */
public static final String ID_CELEMENT_CREATION_ACTION_SET= "org.eclipse.cdt.ui.CElementCreationActionSet"; //$NON-NLS-1$ public static final String ID_CELEMENT_CREATION_ACTION_SET= "org.eclipse.cdt.ui.CElementCreationActionSet"; //$NON-NLS-1$
/** /**
* The id of the scope used by all the CDT views * The id of the scope used by all the CDT views
* (value <code>"org.eclipse.cdt.ui.scope"</code>). * (value <code>"org.eclipse.cdt.ui.scope"</code>).
* @since 4.0 * @since 4.0
*/ */
public static final String CVIEWS_SCOPE = "org.eclipse.cdt.ui.cViewScope"; //$NON-NLS-1$ public static final String CVIEWS_SCOPE = "org.eclipse.cdt.ui.cViewScope"; //$NON-NLS-1$
/** /**
* The key to store customized code templates. * The key to store customized code templates.
* @since 5.0 * @since 5.0
*/ */
private static final String CODE_TEMPLATES_KEY= "org.eclipse.cdt.ui.text.custom_code_templates"; //$NON-NLS-1$ private static final String CODE_TEMPLATES_KEY= "org.eclipse.cdt.ui.text.custom_code_templates"; //$NON-NLS-1$
@ -253,11 +257,11 @@ public class CUIPlugin extends AbstractUIPlugin {
public synchronized IBufferFactory getBufferFactory() { public synchronized IBufferFactory getBufferFactory() {
return ((WorkingCopyManager) getWorkingCopyManager()).getBufferFactory(); return ((WorkingCopyManager) getWorkingCopyManager()).getBufferFactory();
} }
public static IWorkingCopy[] getSharedWorkingCopies() { public static IWorkingCopy[] getSharedWorkingCopies() {
return getDefault().getWorkingCopyManager().getSharedWorkingCopies(); return getDefault().getWorkingCopyManager().getSharedWorkingCopies();
} }
public static String getResourceString(String key) { public static String getResourceString(String key) {
try { try {
return fgResourceBundle.getString(key); return fgResourceBundle.getString(key);
@ -271,7 +275,7 @@ public class CUIPlugin extends AbstractUIPlugin {
public static IWorkspace getWorkspace() { public static IWorkspace getWorkspace() {
return ResourcesPlugin.getWorkspace(); return ResourcesPlugin.getWorkspace();
} }
public static String getFormattedString(String key, String arg) { public static String getFormattedString(String key, String arg) {
return MessageFormat.format(getResourceString(key), new Object[] {arg}); return MessageFormat.format(getResourceString(key), new Object[] {arg});
} }
@ -283,7 +287,7 @@ public class CUIPlugin extends AbstractUIPlugin {
public static ResourceBundle getResourceBundle() { public static ResourceBundle getResourceBundle() {
return fgResourceBundle; return fgResourceBundle;
} }
public static IWorkbenchWindow getActiveWorkbenchWindow() { public static IWorkbenchWindow getActiveWorkbenchWindow() {
return getDefault().getWorkbench().getActiveWorkbenchWindow(); return getDefault().getWorkbench().getActiveWorkbenchWindow();
} }
@ -319,7 +323,7 @@ public class CUIPlugin extends AbstractUIPlugin {
public static void log(IStatus status) { public static void log(IStatus status) {
getDefault().getLog().log(status); getDefault().getLog().log(status);
} }
/** /**
* @noreference This method is not intended to be referenced by clients. * @noreference This method is not intended to be referenced by clients.
*/ */
@ -342,7 +346,7 @@ public class CUIPlugin extends AbstractUIPlugin {
public static void errorDialog(Shell shell, String title, String message, IStatus s, boolean logError) { public static void errorDialog(Shell shell, String title, String message, IStatus s, boolean logError) {
if (logError) if (logError)
log(s); log(s);
// if the 'message' resource string and the IStatus' message are the same, // if the 'message' resource string and the IStatus' message are the same,
// don't show both in the dialog // don't show both in the dialog
if (s != null && message.equals(s.getMessage())) { if (s != null && message.equals(s.getMessage())) {
@ -358,7 +362,7 @@ public class CUIPlugin extends AbstractUIPlugin {
public static void errorDialog(Shell shell, String title, String message, Throwable t, boolean logError) { public static void errorDialog(Shell shell, String title, String message, Throwable t, boolean logError) {
if (logError) if (logError)
log(message, t); log(message, t);
IStatus status; IStatus status;
if (t instanceof CoreException) { if (t instanceof CoreException) {
status = ((CoreException) t).getStatus(); status = ((CoreException) t).getStatus();
@ -368,7 +372,7 @@ public class CUIPlugin extends AbstractUIPlugin {
message = null; message = null;
} }
} else { } else {
status = new Status(IStatus.ERROR, CUIPlugin.PLUGIN_ID, -1, "Internal Error: ", t); //$NON-NLS-1$ status = new Status(IStatus.ERROR, CUIPlugin.PLUGIN_ID, -1, "Internal Error: ", t); //$NON-NLS-1$
} }
ErrorDialog.openError(shell, title, message, status); ErrorDialog.openError(shell, title, message, status);
} }
@ -405,14 +409,14 @@ public class CUIPlugin extends AbstractUIPlugin {
private ResourceAdapterFactory fResourceAdapterFactory; private ResourceAdapterFactory fResourceAdapterFactory;
private CElementAdapterFactory fCElementAdapterFactory; private CElementAdapterFactory fCElementAdapterFactory;
/** /**
* The template context type registry for the C editor. * The template context type registry for the C editor.
* @since 3.0 * @since 3.0
*/ */
private ContributionContextTypeRegistry fContextTypeRegistry; private ContributionContextTypeRegistry fContextTypeRegistry;
/** /**
* The template store for the C editor. * The template store for the C editor.
* @since 3.0 * @since 3.0
*/ */
private TemplateStore fTemplateStore; private TemplateStore fTemplateStore;
@ -423,28 +427,34 @@ public class CUIPlugin extends AbstractUIPlugin {
*/ */
private ASTProvider fASTProvider; private ASTProvider fASTProvider;
/** /**
* The code template context type registry for the C editor. * The code template context type registry for the C editor.
* @since 5.0 * @since 5.0
*/ */
private ContextTypeRegistry fCodeTemplateContextTypeRegistry; private ContextTypeRegistry fCodeTemplateContextTypeRegistry;
/** /**
* The code template store for the C editor. * The code template store for the C editor.
* @since 5.0 * @since 5.0
*/ */
private TemplateStore fCodeTemplateStore; private TemplateStore fCodeTemplateStore;
/**
* Theme listener.
* @since 5.4
*/
private IPropertyChangeListener fThemeListener;
public CUIPlugin() { public CUIPlugin() {
fgCPlugin = this; fgCPlugin = this;
fDocumentProvider = null; fDocumentProvider = null;
fTextTools = null; fTextTools = null;
fBuildConsoleManagers = new HashMap<String, BuildConsoleManager>(); fBuildConsoleManagers = new HashMap<String, BuildConsoleManager>();
} }
/** /**
* Returns the used document provider. * Returns the used document provider.
* *
* @noreference This method is not intended to be referenced by clients. * @noreference This method is not intended to be referenced by clients.
*/ */
public synchronized CDocumentProvider getDocumentProvider() { public synchronized CDocumentProvider getDocumentProvider() {
@ -453,7 +463,7 @@ public class CUIPlugin extends AbstractUIPlugin {
} }
return fDocumentProvider; return fDocumentProvider;
} }
/** /**
* Returns the working copy manager * Returns the working copy manager
* @return IWorkingCopyManager * @return IWorkingCopyManager
@ -487,11 +497,11 @@ public class CUIPlugin extends AbstractUIPlugin {
/** /**
* Obtain a console manager with the given id. If a manager has not been created yet, * Obtain a console manager with the given id. If a manager has not been created yet,
* it is created and its console created and activated. * it is created and its console created and activated.
* *
* @param name - console name. * @param name - console name.
* @param contextId - console id matching context id in the Console view dropdown. * @param contextId - console id matching context id in the Console view dropdown.
* @return console manager. * @return console manager.
* *
* Note that this method is rather internal and should not be referenced by clients. * Note that this method is rather internal and should not be referenced by clients.
* To create a build console, use {@link CCorePlugin#getBuildConsole(String, String, URL)} * To create a build console, use {@link CCorePlugin#getBuildConsole(String, String, URL)}
*/ */
@ -502,7 +512,7 @@ public class CUIPlugin extends AbstractUIPlugin {
/** /**
* Obtain a console manager with the given id. If a manager has not been created yet, * Obtain a console manager with the given id. If a manager has not been created yet,
* it is created and its console created and activated with the given attributes. * it is created and its console created and activated with the given attributes.
* *
* @param name - console name. * @param name - console name.
* @param contextId - console id matching context id in the Console view dropdown. * @param contextId - console id matching context id in the Console view dropdown.
* Can't be {@code null}. * Can't be {@code null}.
@ -510,7 +520,7 @@ public class CUIPlugin extends AbstractUIPlugin {
* view. The url is expected to point to an image in eclipse OSGi bundle. * view. The url is expected to point to an image in eclipse OSGi bundle.
* {@code iconUrl} can be <b>null</b>, in that case the default image is used. * {@code iconUrl} can be <b>null</b>, in that case the default image is used.
* @return console manager. * @return console manager.
* *
* @noreference This method is not intended to be referenced by clients. * @noreference This method is not intended to be referenced by clients.
*/ */
public IBuildConsoleManager getConsoleManager(String name, String contextId, URL iconUrl) { public IBuildConsoleManager getConsoleManager(String name, String contextId, URL iconUrl) {
@ -531,6 +541,7 @@ public class CUIPlugin extends AbstractUIPlugin {
public void startGlobalConsole() { public void startGlobalConsole() {
GlobalBuildConsoleManager.startGlobalConsole(); GlobalBuildConsoleManager.startGlobalConsole();
} }
/* /*
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/ */
@ -540,22 +551,34 @@ public class CUIPlugin extends AbstractUIPlugin {
//Set debug tracing options //Set debug tracing options
configurePluginDebugOptions(); configurePluginDebugOptions();
registerAdapters(); registerAdapters();
IWorkingCopyProvider workingCopyProvider = new IWorkingCopyProvider() { IWorkingCopyProvider workingCopyProvider = new IWorkingCopyProvider() {
@Override
public IWorkingCopy[] getWorkingCopies() { public IWorkingCopy[] getWorkingCopies() {
return CUIPlugin.getSharedWorkingCopies(); return CUIPlugin.getSharedWorkingCopies();
} }
}; };
CCorePlugin.getDefault().getDOM().setWorkingCopyProvider(workingCopyProvider); CCorePlugin.getDefault().getDOM().setWorkingCopyProvider(workingCopyProvider);
// init ast provider if (PlatformUI.isWorkbenchRunning()) {
getASTProvider(); // Initialize AST provider
getASTProvider();
fThemeListener= new IPropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent event) {
if (IThemeManager.CHANGE_CURRENT_THEME.equals(event.getProperty()))
CUIPreferenceInitializer.setThemeBasedPreferences(PreferenceConstants.getPreferenceStore(), true);
}
};
PlatformUI.getWorkbench().getThemeManager().addPropertyChangeListener(fThemeListener);
}
CDTContextActivator.getInstance().install(); CDTContextActivator.getInstance().install();
DocCommentOwnerManager.getInstance().addListener(new EditorReopener()); DocCommentOwnerManager.getInstance().addListener(new EditorReopener());
ASTRewriteAnalyzer.setCTextFileChangeFactory(new CTextFileChangeFactory()); ASTRewriteAnalyzer.setCTextFileChangeFactory(new CTextFileChangeFactory());
// A workaround for black console bug 320723. // A workaround for black console bug 320723.
BuildConsolePreferencePage.initDefaults(getPreferenceStore()); BuildConsolePreferencePage.initDefaults(getPreferenceStore());
//initialize ContentAssistMatcherPreference //initialize ContentAssistMatcherPreference
@ -612,7 +635,7 @@ public class CUIPlugin extends AbstractUIPlugin {
} }
fBuildConsoleManagers.clear(); fBuildConsoleManagers.clear();
} }
GlobalBuildConsoleManager.stop(); GlobalBuildConsoleManager.stop();
unregisterAdapters(); unregisterAdapters();
@ -621,14 +644,19 @@ public class CUIPlugin extends AbstractUIPlugin {
fWorkingCopyManager.shutdown(); fWorkingCopyManager.shutdown();
fWorkingCopyManager= null; fWorkingCopyManager= null;
} }
if (fDocumentProvider != null) { if (fDocumentProvider != null) {
fDocumentProvider.shutdown(); fDocumentProvider.shutdown();
fDocumentProvider= null; fDocumentProvider= null;
} }
ContentAssistPreference.shutdown(); ContentAssistPreference.shutdown();
if (fThemeListener != null) {
PlatformUI.getWorkbench().getThemeManager().removePropertyChangeListener(fThemeListener);
fThemeListener= null;
}
// Do this last. // Do this last.
super.stop(context); super.stop(context);
} }
@ -656,7 +684,7 @@ public class CUIPlugin extends AbstractUIPlugin {
/** /**
* Returns the problem marker manager. * Returns the problem marker manager.
* *
* @noreference This method is not intended to be referenced by clients. * @noreference This method is not intended to be referenced by clients.
*/ */
public ProblemMarkerManager getProblemMarkerManager() { public ProblemMarkerManager getProblemMarkerManager() {
@ -673,14 +701,14 @@ public class CUIPlugin extends AbstractUIPlugin {
manager.registerAdapters(fResourceAdapterFactory, IResource.class); manager.registerAdapters(fResourceAdapterFactory, IResource.class);
manager.registerAdapters(fCElementAdapterFactory, ICElement.class); manager.registerAdapters(fCElementAdapterFactory, ICElement.class);
} }
private void unregisterAdapters() { private void unregisterAdapters() {
IAdapterManager manager = Platform.getAdapterManager(); IAdapterManager manager = Platform.getAdapterManager();
manager.unregisterAdapters(fResourceAdapterFactory); manager.unregisterAdapters(fResourceAdapterFactory);
manager.unregisterAdapters(fCElementAdapterFactory); manager.unregisterAdapters(fCElementAdapterFactory);
} }
/** /**
* @deprecated Use {@link EditorsUI#getSharedTextColors()} instead. * @deprecated Use {@link EditorsUI#getSharedTextColors()} instead.
* @noreference This method is not intended to be referenced by clients. * @noreference This method is not intended to be referenced by clients.
*/ */
@ -688,7 +716,7 @@ public class CUIPlugin extends AbstractUIPlugin {
public ISharedTextColors getSharedTextColors() { public ISharedTextColors getSharedTextColors() {
return EditorsUI.getSharedTextColors(); return EditorsUI.getSharedTextColors();
} }
public void configurePluginDebugOptions() { public void configurePluginDebugOptions() {
if (isDebugging()) { if (isDebugging()) {
String option = Platform.getDebugOption(CONTENTASSIST); String option = Platform.getDebugOption(CONTENTASSIST);
@ -699,17 +727,17 @@ public class CUIPlugin extends AbstractUIPlugin {
/** /**
* Returns a combined preference store, this store is read-only. * Returns a combined preference store, this store is read-only.
* *
* @return the combined preference store * @return the combined preference store
* *
* @since 3.0 * @since 3.0
*/ */
public IPreferenceStore getCombinedPreferenceStore() { public IPreferenceStore getCombinedPreferenceStore() {
if (fCombinedPreferenceStore == null) { if (fCombinedPreferenceStore == null) {
fCombinedPreferenceStore= new ChainedPreferenceStore(new IPreferenceStore[] { fCombinedPreferenceStore= new ChainedPreferenceStore(new IPreferenceStore[] {
getPreferenceStore(), getPreferenceStore(),
getCorePreferenceStore(), getCorePreferenceStore(),
EditorsUI.getPreferenceStore() EditorsUI.getPreferenceStore()
}); });
} }
return fCombinedPreferenceStore; return fCombinedPreferenceStore;
@ -744,11 +772,11 @@ public class CUIPlugin extends AbstractUIPlugin {
} }
/** /**
* Returns an array of all editors that have an unsaved content. If the identical content is * Returns an array of all editors that have an unsaved content. If the identical content is
* presented in more than one editor, only one of those editor parts is part of the result. * presented in more than one editor, only one of those editor parts is part of the result.
* *
* @return an array of all dirty editor parts. * @return an array of all dirty editor parts.
*/ */
public static IEditorPart[] getDirtyEditors() { public static IEditorPart[] getDirtyEditors() {
Set<IEditorInput> inputs= new HashSet<IEditorInput>(); Set<IEditorInput> inputs= new HashSet<IEditorInput>();
List<IEditorPart> result= new ArrayList<IEditorPart>(0); List<IEditorPart> result= new ArrayList<IEditorPart>(0);
@ -770,7 +798,7 @@ public class CUIPlugin extends AbstractUIPlugin {
return result.toArray(new IEditorPart[result.size()]); return result.toArray(new IEditorPart[result.size()]);
} }
/** /**
* Returns an array of all instanciated editors. * Returns an array of all instanciated editors.
*/ */
public static IEditorPart[] getInstanciatedEditors() { public static IEditorPart[] getInstanciatedEditors() {
List<IEditorPart> result= new ArrayList<IEditorPart>(0); List<IEditorPart> result= new ArrayList<IEditorPart>(0);
@ -800,8 +828,8 @@ public class CUIPlugin extends AbstractUIPlugin {
if (display == null) { if (display == null) {
display= Display.getDefault(); display= Display.getDefault();
} }
return display; return display;
} }
/** /**
* Creates the CUIplugin standard groups in a context menu. * Creates the CUIplugin standard groups in a context menu.
@ -826,9 +854,9 @@ public class CUIPlugin extends AbstractUIPlugin {
/** /**
* Returns all C editor text hovers contributed to the workbench. * Returns all C editor text hovers contributed to the workbench.
* *
* @return an array of CEditorTextHoverDescriptor * @return an array of CEditorTextHoverDescriptor
* *
* @noreference This method is not intended to be referenced by clients. * @noreference This method is not intended to be referenced by clients.
*/ */
public CEditorTextHoverDescriptor[] getCEditorTextHoverDescriptors() { public CEditorTextHoverDescriptor[] getCEditorTextHoverDescriptors() {
@ -844,7 +872,7 @@ public class CUIPlugin extends AbstractUIPlugin {
} }
}; };
sorter.sort(fCEditorTextHoverDescriptors); sorter.sort(fCEditorTextHoverDescriptors);
// The Problem hover has to be the first and the Annotation hover has to be the last one in the CDT UI's hover list // The Problem hover has to be the first and the Annotation hover has to be the last one in the CDT UI's hover list
int length= fCEditorTextHoverDescriptors.length; int length= fCEditorTextHoverDescriptors.length;
int first= -1; int first= -1;
@ -861,7 +889,7 @@ public class CUIPlugin extends AbstractUIPlugin {
} }
if (first == -1) if (first == -1)
first= i; first= i;
if (fCEditorTextHoverDescriptors[i].getId().equals("org.eclipse.cdt.ui.AnnotationHover")) { //$NON-NLS-1$ if (fCEditorTextHoverDescriptors[i].getId().equals("org.eclipse.cdt.ui.AnnotationHover")) { //$NON-NLS-1$
annotationHoverIndex= i; annotationHoverIndex= i;
continue; continue;
@ -871,9 +899,9 @@ public class CUIPlugin extends AbstractUIPlugin {
continue; continue;
} }
} }
CEditorTextHoverDescriptor hoverDescriptor= null; CEditorTextHoverDescriptor hoverDescriptor= null;
if (first > -1 && problemHoverIndex > -1 && problemHoverIndex > first) { if (first > -1 && problemHoverIndex > -1 && problemHoverIndex > first) {
// move problem hover to beginning // move problem hover to beginning
hoverDescriptor= fCEditorTextHoverDescriptors[problemHoverIndex]; hoverDescriptor= fCEditorTextHoverDescriptors[problemHoverIndex];
@ -884,7 +912,7 @@ public class CUIPlugin extends AbstractUIPlugin {
if (annotationHoverIndex >= first && annotationHoverIndex < problemHoverIndex) if (annotationHoverIndex >= first && annotationHoverIndex < problemHoverIndex)
annotationHoverIndex++; annotationHoverIndex++;
} }
if (annotationHoverIndex > -1 && annotationHoverIndex < last) { if (annotationHoverIndex > -1 && annotationHoverIndex < last) {
// move annotation hover to end // move annotation hover to end
hoverDescriptor= fCEditorTextHoverDescriptors[annotationHoverIndex]; hoverDescriptor= fCEditorTextHoverDescriptors[annotationHoverIndex];
@ -903,11 +931,11 @@ public class CUIPlugin extends AbstractUIPlugin {
} }
break; break;
} }
} }
} }
return fCEditorTextHoverDescriptors; return fCEditorTextHoverDescriptors;
} }
/** /**
* Resets the C editor text hovers contributed to the workbench. * Resets the C editor text hovers contributed to the workbench.
@ -915,7 +943,7 @@ public class CUIPlugin extends AbstractUIPlugin {
* This will force a rebuild of the descriptors the next time * This will force a rebuild of the descriptors the next time
* a client asks for them. * a client asks for them.
* </p> * </p>
* *
*/ */
public void resetCEditorTextHoverDescriptors() { public void resetCEditorTextHoverDescriptors() {
fCEditorTextHoverDescriptors= null; fCEditorTextHoverDescriptors= null;
@ -924,9 +952,9 @@ public class CUIPlugin extends AbstractUIPlugin {
/** /**
* Returns the registry of the extensions to the <code>org.eclipse.cdt.ui.foldingStructureProviders</code> * Returns the registry of the extensions to the <code>org.eclipse.cdt.ui.foldingStructureProviders</code>
* extension point. * extension point.
* *
* @return the registry of contributed <code>ICFoldingStructureProvider</code> * @return the registry of contributed <code>ICFoldingStructureProvider</code>
* *
* @noreference This method is not intended to be referenced by clients. * @noreference This method is not intended to be referenced by clients.
* @since 3.0 * @since 3.0
*/ */
@ -938,7 +966,7 @@ public class CUIPlugin extends AbstractUIPlugin {
/** /**
* Returns the template context type registry for the C plugin. * Returns the template context type registry for the C plugin.
* *
* @return the template context type registry for the C plugin * @return the template context type registry for the C plugin
* @since 3.0 * @since 3.0
*/ */
@ -954,7 +982,7 @@ public class CUIPlugin extends AbstractUIPlugin {
/** /**
* Returns the template store for the C editor templates. * Returns the template store for the C editor templates.
* *
* @return the template store for the C editor templates * @return the template store for the C editor templates
* @since 3.0 * @since 3.0
*/ */
@ -973,7 +1001,7 @@ public class CUIPlugin extends AbstractUIPlugin {
/** /**
* Returns the template context type registry for the code generation * Returns the template context type registry for the code generation
* templates. * templates.
* *
* @return the template context type registry for the code generation * @return the template context type registry for the code generation
* templates * templates
* @since 5.0 * @since 5.0
@ -981,17 +1009,17 @@ public class CUIPlugin extends AbstractUIPlugin {
public ContextTypeRegistry getCodeTemplateContextRegistry() { public ContextTypeRegistry getCodeTemplateContextRegistry() {
if (fCodeTemplateContextTypeRegistry == null) { if (fCodeTemplateContextTypeRegistry == null) {
fCodeTemplateContextTypeRegistry= new ContributionContextTypeRegistry("org.eclipse.cdt.ui.codeTemplates"); //$NON-NLS-1$ fCodeTemplateContextTypeRegistry= new ContributionContextTypeRegistry("org.eclipse.cdt.ui.codeTemplates"); //$NON-NLS-1$
CodeTemplateContextType.registerContextTypes(fCodeTemplateContextTypeRegistry); CodeTemplateContextType.registerContextTypes(fCodeTemplateContextTypeRegistry);
FileTemplateContextType.registerContextTypes(fCodeTemplateContextTypeRegistry); FileTemplateContextType.registerContextTypes(fCodeTemplateContextTypeRegistry);
} }
return fCodeTemplateContextTypeRegistry; return fCodeTemplateContextTypeRegistry;
} }
/** /**
* Returns the template store for the code generation templates. * Returns the template store for the code generation templates.
* *
* @return the template store for the code generation templates * @return the template store for the code generation templates
* @since 5.0 * @since 5.0
*/ */
@ -1005,30 +1033,30 @@ public class CUIPlugin extends AbstractUIPlugin {
} catch (IOException e) { } catch (IOException e) {
log(e); log(e);
} }
fCodeTemplateStore.startListeningForPreferenceChanges(); fCodeTemplateStore.startListeningForPreferenceChanges();
} }
return fCodeTemplateStore; return fCodeTemplateStore;
} }
/** /**
* Returns the AST provider. * Returns the AST provider.
* *
* @return the AST provider * @return the AST provider
* *
* @noreference This method is not intended to be referenced by clients. * @noreference This method is not intended to be referenced by clients.
* @since 4.0 * @since 4.0
*/ */
public synchronized ASTProvider getASTProvider() { public synchronized ASTProvider getASTProvider() {
if (fASTProvider == null) if (fASTProvider == null)
fASTProvider= new ASTProvider(); fASTProvider= new ASTProvider();
return fASTProvider; return fASTProvider;
} }
/** /**
* Answers the <code>Shell</code> associated with the active workbench, or * Answers the <code>Shell</code> associated with the active workbench, or
* one of the windows associated with the workbench. * one of the windows associated with the workbench.
*/ */
public Shell getShell() { public Shell getShell() {

View file

@ -1,15 +1,26 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2003, 2009 IBM Corporation and others. * Copyright (c) 2003, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* QNX Software Systems - Initial implementation * QNX Software Systems - Initial implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.ui; package org.eclipse.cdt.ui;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.jface.resource.ColorRegistry;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.editors.text.EditorsUI;
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
import org.eclipse.ui.texteditor.AbstractTextEditor;
import org.eclipse.cdt.internal.ui.ICThemeConstants;
import org.eclipse.cdt.internal.ui.cview.CView; import org.eclipse.cdt.internal.ui.cview.CView;
import org.eclipse.cdt.internal.ui.editor.SemanticHighlightings; import org.eclipse.cdt.internal.ui.editor.SemanticHighlightings;
import org.eclipse.cdt.internal.ui.preferences.BuildConsolePreferencePage; import org.eclipse.cdt.internal.ui.preferences.BuildConsolePreferencePage;
@ -18,19 +29,13 @@ import org.eclipse.cdt.internal.ui.preferences.CPluginPreferencePage;
import org.eclipse.cdt.internal.ui.preferences.CodeAssistPreferencePage; import org.eclipse.cdt.internal.ui.preferences.CodeAssistPreferencePage;
import org.eclipse.cdt.internal.ui.preferences.WorkInProgressPreferencePage; import org.eclipse.cdt.internal.ui.preferences.WorkInProgressPreferencePage;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.editors.text.EditorsUI;
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
import org.eclipse.ui.texteditor.AbstractTextEditor;
/** /**
* This class implements the setting of the CUI initial preference store settings. * This class implements the setting of the CUI initial preference store settings.
* *
* @noextend This class is not intended to be subclassed by clients. * @noextend This class is not intended to be subclassed by clients.
*/ */
public class CUIPreferenceInitializer extends AbstractPreferenceInitializer { public class CUIPreferenceInitializer extends AbstractPreferenceInitializer {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
*/ */
@ -46,7 +51,7 @@ public class CUIPreferenceInitializer extends AbstractPreferenceInitializer {
CodeAssistPreferencePage.initDefaults(store); CodeAssistPreferencePage.initDefaults(store);
SemanticHighlightings.initDefaults(store); SemanticHighlightings.initDefaults(store);
WorkInProgressPreferencePage.initDefaults(store); WorkInProgressPreferencePage.initDefaults(store);
// We need to do this remove any keys that might have been // We need to do this remove any keys that might have been
// in the CUIPlugin store prior to the move of the CEditor setting // in the CUIPlugin store prior to the move of the CEditor setting
// All of those settings are now in the workbench "All TextEditor" preference Page. // All of those settings are now in the workbench "All TextEditor" preference Page.
@ -63,7 +68,7 @@ public class CUIPreferenceInitializer extends AbstractPreferenceInitializer {
store.setToDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE); store.setToDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE);
store.setToDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR); store.setToDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR);
store.setToDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER); store.setToDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER);
store.setToDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR); store.setToDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR);
store.setToDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_OVERVIEW_RULER); store.setToDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_OVERVIEW_RULER);
@ -72,10 +77,10 @@ public class CUIPreferenceInitializer extends AbstractPreferenceInitializer {
store.setToDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN); store.setToDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN);
store.setToDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR); store.setToDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR);
store.setToDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN); store.setToDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN);
store.setToDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_USE_CUSTOM_CARETS); store.setToDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_USE_CUSTOM_CARETS);
store.setToDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_WIDE_CARET); store.setToDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_WIDE_CARET);
store.setToDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_FOREGROUND_COLOR); store.setToDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_FOREGROUND_COLOR);
store.setToDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_BACKGROUND_COLOR); store.setToDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_BACKGROUND_COLOR);
store.setToDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_FOREGROUND_DEFAULT_COLOR); store.setToDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_FOREGROUND_DEFAULT_COLOR);
@ -88,4 +93,145 @@ public class CUIPreferenceInitializer extends AbstractPreferenceInitializer {
store.setToDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_DISABLE_OVERWRITE_MODE); store.setToDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_DISABLE_OVERWRITE_MODE);
store.setToDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SMART_HOME_END); store.setToDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SMART_HOME_END);
} }
static void setThemeBasedPreferences(IPreferenceStore store, boolean fireEvent) {
ColorRegistry registry= null;
if (PlatformUI.isWorkbenchRunning())
registry= PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry();
setDefault(
store,
PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_COLOR,
findRGB(registry, ICThemeConstants.EDITOR_MULTI_LINE_COMMENT_COLOR, new RGB(63, 127, 95)), fireEvent);
setDefault(
store,
PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_COLOR,
findRGB(registry, ICThemeConstants.EDITOR_SINGLE_LINE_COMMENT_COLOR, new RGB(63, 127, 95)), fireEvent);
setDefault(
store,
PreferenceConstants.EDITOR_TASK_TAG_COLOR,
findRGB(registry, ICThemeConstants.EDITOR_TASK_TAG_COLOR, new RGB(127, 159, 191)), fireEvent);
setDefault(
store,
PreferenceConstants.EDITOR_C_KEYWORD_COLOR,
findRGB(registry, ICThemeConstants.EDITOR_C_KEYWORD_COLOR, new RGB(127, 0, 85)), fireEvent);
setDefault(
store,
PreferenceConstants.EDITOR_C_BUILTIN_TYPE_COLOR,
findRGB(registry, ICThemeConstants.EDITOR_C_BUILTIN_TYPE_COLOR, new RGB(127, 0, 85)), fireEvent);
setDefault(
store,
PreferenceConstants.EDITOR_C_STRING_COLOR,
findRGB(registry, ICThemeConstants.EDITOR_C_STRING_COLOR, new RGB(42, 0, 255)), fireEvent);
setDefault(
store,
PreferenceConstants.EDITOR_C_DEFAULT_COLOR,
findRGB(registry, ICThemeConstants.EDITOR_C_DEFAULT_COLOR, new RGB(0, 0, 0)), fireEvent);
setDefault(
store,
PreferenceConstants.EDITOR_C_OPERATOR_COLOR,
findRGB(registry, ICThemeConstants.EDITOR_C_OPERATOR_COLOR, new RGB(0, 0, 0)), fireEvent);
setDefault(
store,
PreferenceConstants.EDITOR_C_BRACES_COLOR,
findRGB(registry, ICThemeConstants.EDITOR_C_BRACES_COLOR, new RGB(0, 0, 0)), fireEvent);
setDefault(
store,
PreferenceConstants.EDITOR_C_NUMBER_COLOR,
findRGB(registry, ICThemeConstants.EDITOR_C_NUMBER_COLOR, new RGB(0, 0, 0)), fireEvent);
setDefault(
store,
PreferenceConstants.EDITOR_PP_DIRECTIVE_COLOR,
findRGB(registry, ICThemeConstants.EDITOR_PP_DIRECTIVE_COLOR, new RGB(127, 0, 85)), fireEvent);
setDefault(
store,
PreferenceConstants.EDITOR_PP_HEADER_COLOR,
findRGB(registry, ICThemeConstants.EDITOR_PP_HEADER_COLOR, new RGB(42, 0, 255)), fireEvent);
setDefault(
store,
PreferenceConstants.EDITOR_PP_DEFAULT_COLOR,
findRGB(registry, ICThemeConstants.EDITOR_PP_DEFAULT_COLOR, new RGB(0, 0, 0)), fireEvent);
setDefault(
store,
PreferenceConstants.EDITOR_ASM_LABEL_COLOR,
findRGB(registry, ICThemeConstants.EDITOR_ASM_LABEL_COLOR, new RGB(127, 0, 85)), fireEvent);
setDefault(
store,
PreferenceConstants.EDITOR_ASM_DIRECTIVE_COLOR,
findRGB(registry, ICThemeConstants.EDITOR_ASM_DIRECTIVE_COLOR, new RGB(127, 0, 85)), fireEvent);
setDefault(
store,
PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND,
findRGB(registry, ICThemeConstants.CODEASSIST_PROPOSALS_BACKGROUND, new RGB(255, 255, 255)), fireEvent);
setDefault(
store,
PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND,
findRGB(registry, ICThemeConstants.CODEASSIST_PROPOSALS_FOREGROUND, new RGB(0, 0, 0)), fireEvent);
setDefault(
store,
PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND,
findRGB(registry, ICThemeConstants.CODEASSIST_PARAMETERS_BACKGROUND, new RGB(255, 255, 255)), fireEvent);
setDefault(
store,
PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND,
findRGB(registry, ICThemeConstants.CODEASSIST_PARAMETERS_FOREGROUND, new RGB(0, 0, 0)), fireEvent);
setDefault(
store,
PreferenceConstants.DOXYGEN_MULTI_LINE_COLOR,
findRGB(registry, ICThemeConstants.DOXYGEN_MULTI_LINE_COLOR, new RGB(63, 95, 191)), fireEvent);
setDefault(
store,
PreferenceConstants.DOXYGEN_SINGLE_LINE_COLOR,
findRGB(registry, ICThemeConstants.DOXYGEN_SINGLE_LINE_COLOR, new RGB(63, 95, 191)), fireEvent);
setDefault(
store,
PreferenceConstants.DOXYGEN_TAG_COLOR,
findRGB(registry, ICThemeConstants.DOXYGEN_TAG_COLOR, new RGB(127, 159, 191)), fireEvent);
}
/**
* Sets the default value and fires a property
* change event if necessary.
*
* @param store the preference store
* @param key the preference key
* @param newValue the new value
* @param fireEvent <code>false</code> if no event should be fired
* @since 5.4
*/
private static void setDefault(IPreferenceStore store, String key, RGB newValue, boolean fireEvent) {
if (!fireEvent) {
PreferenceConverter.setDefault(store, key, newValue);
return;
}
RGB oldValue= null;
if (store.isDefault(key))
oldValue= PreferenceConverter.getDefaultColor(store, key);
PreferenceConverter.setDefault(store, key, newValue);
if (oldValue != null && !oldValue.equals(newValue))
store.firePropertyChangeEvent(key, oldValue, newValue);
}
/**
* Returns the RGB for the given key in the given color registry.
*
* @param registry the color registry
* @param key the key for the constant in the registry
* @param defaultRGB the default RGB if no entry is found
* @return RGB the RGB
* @since 5.4
*/
private static RGB findRGB(ColorRegistry registry, String key, RGB defaultRGB) {
if (registry == null)
return defaultRGB;
RGB rgb= registry.getRGB(key);
if (rgb != null)
return rgb;
return defaultRGB;
}
} }

View file

@ -23,17 +23,12 @@ import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope; import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.action.Action; import org.eclipse.jface.action.Action;
import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.jface.resource.ColorRegistry;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants; import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
import org.eclipse.cdt.core.model.ICProject; import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.ui.text.ICColorConstants; import org.eclipse.cdt.ui.text.ICColorConstants;
import org.eclipse.cdt.internal.ui.ICThemeConstants;
import org.eclipse.cdt.internal.ui.preferences.formatter.FormatterProfileManager; import org.eclipse.cdt.internal.ui.preferences.formatter.FormatterProfileManager;
import org.eclipse.cdt.internal.ui.text.spelling.SpellCheckEngine; import org.eclipse.cdt.internal.ui.text.spelling.SpellCheckEngine;
@ -554,6 +549,45 @@ public class PreferenceConstants {
*/ */
public final static String EDITOR_ASM_DIRECTIVE_ITALIC= ICColorConstants.ASM_DIRECTIVE + EDITOR_ITALIC_SUFFIX; public final static String EDITOR_ASM_DIRECTIVE_ITALIC= ICColorConstants.ASM_DIRECTIVE + EDITOR_ITALIC_SUFFIX;
/**
* A named preference that holds the color used to render doxygen tags.
* <p>
* Value is of type <code>String</code>. A RGB color value encoded as a string
* using class <code>PreferenceConverter</code>
* </p>
*
* @see org.eclipse.jface.resource.StringConverter
* @see org.eclipse.jface.preference.PreferenceConverter
* @since 5.4
*/
public static final String DOXYGEN_TAG_COLOR= "org.eclipse.cdt.internal.ui.text.doctools.doxygen.recognizedTag"; //$NON-NLS-1$
/**
* A named preference that holds the color used to render doxygen single line comments.
* <p>
* Value is of type <code>String</code>. A RGB color value encoded as a string
* using class <code>PreferenceConverter</code>
* </p>
*
* @see org.eclipse.jface.resource.StringConverter
* @see org.eclipse.jface.preference.PreferenceConverter
* @since 5.4
*/
public static final String DOXYGEN_SINGLE_LINE_COLOR= "org.eclipse.cdt.internal.ui.text.doctools.doxygen.single"; //$NON-NLS-1$
/**
* A named preference that holds the color used to render doxygen multi-line comments.
* <p>
* Value is of type <code>String</code>. A RGB color value encoded as a string
* using class <code>PreferenceConverter</code>
* </p>
*
* @see org.eclipse.jface.resource.StringConverter
* @see org.eclipse.jface.preference.PreferenceConverter
* @since 5.4
*/
public static final String DOXYGEN_MULTI_LINE_COLOR= "org.eclipse.cdt.internal.ui.text.doctools.doxygen.multi"; //$NON-NLS-1$
/** /**
* The symbolic font name for the C/C++ editor text font * The symbolic font name for the C/C++ editor text font
* (value <code>"org.eclipse.cdt.ui.editors.textfont"</code>). * (value <code>"org.eclipse.cdt.ui.editors.textfont"</code>).
@ -1859,8 +1893,6 @@ public class PreferenceConstants {
* @param store the preference store to be initialized * @param store the preference store to be initialized
*/ */
public static void initializeDefaultValues(IPreferenceStore store) { public static void initializeDefaultValues(IPreferenceStore store) {
ColorRegistry registry= PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry();
store.setDefault(PreferenceConstants.EDITOR_CORRECTION_INDICATION, false); store.setDefault(PreferenceConstants.EDITOR_CORRECTION_INDICATION, false);
store.setDefault(PreferenceConstants.EDITOR_SHOW_SEGMENTS, false); store.setDefault(PreferenceConstants.EDITOR_SHOW_SEGMENTS, false);
store.setDefault(PreferenceConstants.PREF_SHOW_CU_CHILDREN, true); store.setDefault(PreferenceConstants.PREF_SHOW_CU_CHILDREN, true);
@ -1875,64 +1907,49 @@ public class PreferenceConstants {
store.setDefault(EDITOR_SOURCE_HOVER_BACKGROUND_COLOR_SYSTEM_DEFAULT, true); store.setDefault(EDITOR_SOURCE_HOVER_BACKGROUND_COLOR_SYSTEM_DEFAULT, true);
// Coloring // Syntax highlighting
PreferenceConverter.setDefault(store, EDITOR_MULTI_LINE_COMMENT_COLOR, new RGB(63, 127, 95));
store.setDefault(EDITOR_MULTI_LINE_COMMENT_BOLD, false); store.setDefault(EDITOR_MULTI_LINE_COMMENT_BOLD, false);
store.setDefault(EDITOR_MULTI_LINE_COMMENT_ITALIC, false); store.setDefault(EDITOR_MULTI_LINE_COMMENT_ITALIC, false);
PreferenceConverter.setDefault(store, EDITOR_SINGLE_LINE_COMMENT_COLOR, new RGB(63, 127, 95));
store.setDefault(EDITOR_SINGLE_LINE_COMMENT_BOLD, false); store.setDefault(EDITOR_SINGLE_LINE_COMMENT_BOLD, false);
store.setDefault(EDITOR_SINGLE_LINE_COMMENT_ITALIC, false); store.setDefault(EDITOR_SINGLE_LINE_COMMENT_ITALIC, false);
PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_TASK_TAG_COLOR, new RGB(127, 159, 191)); store.setDefault(EDITOR_TASK_TAG_BOLD, true);
store.setDefault(PreferenceConstants.EDITOR_TASK_TAG_BOLD, true); store.setDefault(EDITOR_TASK_TAG_ITALIC, false);
store.setDefault(PreferenceConstants.EDITOR_TASK_TAG_ITALIC, false);
PreferenceConverter.setDefault(store, EDITOR_C_KEYWORD_COLOR, new RGB(127, 0, 85));
store.setDefault(EDITOR_C_KEYWORD_BOLD, true); store.setDefault(EDITOR_C_KEYWORD_BOLD, true);
store.setDefault(EDITOR_C_KEYWORD_ITALIC, false); store.setDefault(EDITOR_C_KEYWORD_ITALIC, false);
PreferenceConverter.setDefault(store, EDITOR_C_BUILTIN_TYPE_COLOR, new RGB(127, 0, 85));
store.setDefault(EDITOR_C_BUILTIN_TYPE_BOLD, true); store.setDefault(EDITOR_C_BUILTIN_TYPE_BOLD, true);
store.setDefault(EDITOR_C_BUILTIN_TYPE_ITALIC, false); store.setDefault(EDITOR_C_BUILTIN_TYPE_ITALIC, false);
PreferenceConverter.setDefault(store, EDITOR_C_STRING_COLOR, new RGB(42, 0, 255));
store.setDefault(EDITOR_C_STRING_BOLD, false); store.setDefault(EDITOR_C_STRING_BOLD, false);
store.setDefault(EDITOR_C_STRING_ITALIC, false); store.setDefault(EDITOR_C_STRING_ITALIC, false);
PreferenceConverter.setDefault(store, EDITOR_C_DEFAULT_COLOR, new RGB(0, 0, 0));
store.setDefault(EDITOR_C_DEFAULT_BOLD, false); store.setDefault(EDITOR_C_DEFAULT_BOLD, false);
store.setDefault(EDITOR_C_DEFAULT_ITALIC, false); store.setDefault(EDITOR_C_DEFAULT_ITALIC, false);
PreferenceConverter.setDefault(store, EDITOR_C_OPERATOR_COLOR, new RGB(0, 0, 0));
store.setDefault(EDITOR_C_OPERATOR_BOLD, false); store.setDefault(EDITOR_C_OPERATOR_BOLD, false);
store.setDefault(EDITOR_C_OPERATOR_ITALIC, false); store.setDefault(EDITOR_C_OPERATOR_ITALIC, false);
PreferenceConverter.setDefault(store, EDITOR_C_BRACES_COLOR, new RGB(0, 0, 0));
store.setDefault(EDITOR_C_BRACES_BOLD, false); store.setDefault(EDITOR_C_BRACES_BOLD, false);
store.setDefault(EDITOR_C_BRACES_ITALIC, false); store.setDefault(EDITOR_C_BRACES_ITALIC, false);
PreferenceConverter.setDefault(store, EDITOR_C_NUMBER_COLOR, new RGB(0, 0, 0));
store.setDefault(EDITOR_C_NUMBER_BOLD, false); store.setDefault(EDITOR_C_NUMBER_BOLD, false);
store.setDefault(EDITOR_C_NUMBER_ITALIC, false); store.setDefault(EDITOR_C_NUMBER_ITALIC, false);
PreferenceConverter.setDefault(store, EDITOR_PP_DIRECTIVE_COLOR, new RGB(127, 0, 85));
store.setDefault(EDITOR_PP_DIRECTIVE_BOLD, true); store.setDefault(EDITOR_PP_DIRECTIVE_BOLD, true);
store.setDefault(EDITOR_PP_DIRECTIVE_ITALIC, false); store.setDefault(EDITOR_PP_DIRECTIVE_ITALIC, false);
PreferenceConverter.setDefault(store, EDITOR_PP_HEADER_COLOR, new RGB(42, 0, 255));
store.setDefault(EDITOR_PP_HEADER_BOLD, false); store.setDefault(EDITOR_PP_HEADER_BOLD, false);
store.setDefault(EDITOR_PP_HEADER_ITALIC, false); store.setDefault(EDITOR_PP_HEADER_ITALIC, false);
PreferenceConverter.setDefault(store, EDITOR_PP_DEFAULT_COLOR, new RGB(0, 0, 0));
store.setDefault(EDITOR_PP_DEFAULT_BOLD, false); store.setDefault(EDITOR_PP_DEFAULT_BOLD, false);
store.setDefault(EDITOR_PP_DEFAULT_ITALIC, false); store.setDefault(EDITOR_PP_DEFAULT_ITALIC, false);
PreferenceConverter.setDefault(store, EDITOR_ASM_LABEL_COLOR, new RGB(127, 0, 85));
store.setDefault(EDITOR_ASM_LABEL_BOLD, true); store.setDefault(EDITOR_ASM_LABEL_BOLD, true);
store.setDefault(EDITOR_ASM_LABEL_ITALIC, false); store.setDefault(EDITOR_ASM_LABEL_ITALIC, false);
PreferenceConverter.setDefault(store, EDITOR_ASM_DIRECTIVE_COLOR, new RGB(127, 0, 85));
store.setDefault(EDITOR_ASM_DIRECTIVE_BOLD, true); store.setDefault(EDITOR_ASM_DIRECTIVE_BOLD, true);
store.setDefault(EDITOR_ASM_DIRECTIVE_ITALIC, false); store.setDefault(EDITOR_ASM_DIRECTIVE_ITALIC, false);
@ -1972,23 +1989,6 @@ public class PreferenceConstants {
store.setDefault(PreferenceConstants.CODEASSIST_PROPOSALS_TIMEOUT, 5000); store.setDefault(PreferenceConstants.CODEASSIST_PROPOSALS_TIMEOUT, 5000);
setDefaultAndFireEvent(
store,
PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND,
findRGB(registry, ICThemeConstants.CODEASSIST_PROPOSALS_BACKGROUND, new RGB(255, 255, 255)));
setDefaultAndFireEvent(
store,
PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND,
findRGB(registry, ICThemeConstants.CODEASSIST_PROPOSALS_FOREGROUND, new RGB(0, 0, 0)));
setDefaultAndFireEvent(
store,
PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND,
findRGB(registry, ICThemeConstants.CODEASSIST_PARAMETERS_BACKGROUND, new RGB(255, 255, 255)));
setDefaultAndFireEvent(
store,
PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND,
findRGB(registry, ICThemeConstants.CODEASSIST_PARAMETERS_FOREGROUND, new RGB(0, 0, 0)));
// Refactoring. // Refactoring.
store.setDefault(PreferenceConstants.REFACTOR_SAVE_ALL_EDITORS, false); store.setDefault(PreferenceConstants.REFACTOR_SAVE_ALL_EDITORS, false);
store.setDefault(PreferenceConstants.REFACTOR_LIGHTWEIGHT, true); store.setDefault(PreferenceConstants.REFACTOR_LIGHTWEIGHT, true);
@ -2081,6 +2081,9 @@ public class PreferenceConstants {
store.setDefault(NAME_STYLE_CPP_TEST_PREFIX, ""); //$NON-NLS-1$ store.setDefault(NAME_STYLE_CPP_TEST_PREFIX, ""); //$NON-NLS-1$
store.setDefault(NAME_STYLE_CPP_TEST_SUFFIX, "_test.cpp"); //$NON-NLS-1$ store.setDefault(NAME_STYLE_CPP_TEST_SUFFIX, "_test.cpp"); //$NON-NLS-1$
store.setDefault(NAME_STYLE_CPP_TEST_WORD_DELIMITER, ""); //$NON-NLS-1$ store.setDefault(NAME_STYLE_CPP_TEST_WORD_DELIMITER, ""); //$NON-NLS-1$
// Colors that are set by the current theme
CUIPreferenceInitializer.setThemeBasedPreferences(store, false);
} }
/** /**
@ -2149,39 +2152,4 @@ public class PreferenceConstants {
return getPreferenceNode(key, project).getBoolean(key, defaultValue); return getPreferenceNode(key, project).getBoolean(key, defaultValue);
} }
/**
* Sets the default value and fires a property
* change event if necessary.
*
* @param store the preference store
* @param key the preference key
* @param newValue the new value
* @since 5.0
*/
private static void setDefaultAndFireEvent(IPreferenceStore store, String key, RGB newValue) {
RGB oldValue= null;
if (store.isDefault(key))
oldValue= PreferenceConverter.getDefaultColor(store, key);
PreferenceConverter.setDefault(store, key, newValue);
if (oldValue != null && !oldValue.equals(newValue))
store.firePropertyChangeEvent(key, oldValue, newValue);
}
/**
* Returns the RGB for the given key in the given color registry.
*
* @param registry the color registry
* @param key the key for the constant in the registry
* @param defaultRGB the default RGB if no entry is found
* @return RGB the RGB
* @since 5.0
*/
private static RGB findRGB(ColorRegistry registry, String key, RGB defaultRGB) {
RGB rgb= registry.getRGB(key);
if (rgb != null)
return rgb;
return defaultRGB;
}
} }

View file

@ -1,12 +1,12 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2008, 2009 Symbian Software Systems and others. * Copyright (c) 2008, 2011 Symbian Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Andrew Ferguson (Symbian) - Initial implementation * Andrew Ferguson (Symbian) - Initial implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.ui.text.doctools.doxygen; package org.eclipse.cdt.ui.text.doctools.doxygen;
import java.io.BufferedReader; import java.io.BufferedReader;
@ -20,42 +20,53 @@ import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.ui.PreferenceConstants;
import org.eclipse.cdt.ui.text.doctools.generic.GenericDocTag; import org.eclipse.cdt.ui.text.doctools.generic.GenericDocTag;
/** /**
* Makes available information for Doxygen support. * Makes available information for Doxygen support.
* *
* @since 5.0 * @since 5.0
* @noextend This class is not intended to be subclassed by clients. * @noextend This class is not intended to be subclassed by clients.
*/ */
public class DoxygenHelper extends AbstractPreferenceInitializer { public class DoxygenHelper extends AbstractPreferenceInitializer {
private static final IPath TAGS_CSV= new Path("doxygenTags.csv"); //$NON-NLS-1$ private static final IPath TAGS_CSV= new Path("doxygenTags.csv"); //$NON-NLS-1$
private static GenericDocTag[] fTags; private static GenericDocTag[] fTags;
public static final String DOXYGEN_TAG_RECOGNIZED= "org.eclipse.cdt.internal.ui.text.doctools.doxygen.recognizedTag"; //$NON-NLS-1$ /**
public static final String DOXYGEN_SINGLE_TOKEN= "org.eclipse.cdt.internal.ui.text.doctools.doxygen.single"; //$NON-NLS-1$ * @deprecated Use {@link PreferenceConstants#DOXYGEN_TAG_COLOR} instead.
public static final String DOXYGEN_MULTI_TOKEN= "org.eclipse.cdt.internal.ui.text.doctools.doxygen.multi"; //$NON-NLS-1$ */
@Deprecated
public static final String DOXYGEN_TAG_RECOGNIZED= PreferenceConstants.DOXYGEN_TAG_COLOR;
/**
* @deprecated Use {@link PreferenceConstants#DOXYGEN_SINGLE_LINE_COLOR} instead.
*/
@Deprecated
public static final String DOXYGEN_SINGLE_TOKEN= PreferenceConstants.DOXYGEN_SINGLE_LINE_COLOR;
/**
* @deprecated Use {@link PreferenceConstants#DOXYGEN_MULTI_LINE_COLOR} instead.
*/
@Deprecated
public static final String DOXYGEN_MULTI_TOKEN= PreferenceConstants.DOXYGEN_MULTI_LINE_COLOR;
/** /**
* @return The tags which are understood by default by the doxygen tool. * @return The tags which are understood by default by the doxygen tool.
*/ */
public static GenericDocTag[] getDoxygenTags() { public static GenericDocTag[] getDoxygenTags() {
if(fTags==null) { if(fTags==null) {
InputStream is = null;
try { try {
List<GenericDocTag> temp= new ArrayList<GenericDocTag>(); List<GenericDocTag> temp= new ArrayList<GenericDocTag>();
InputStream is= FileLocator.openStream(CUIPlugin.getDefault().getBundle(), TAGS_CSV, false); is= FileLocator.openStream(CUIPlugin.getDefault().getBundle(), TAGS_CSV, false);
BufferedReader br= new BufferedReader(new InputStreamReader(is)); BufferedReader br= new BufferedReader(new InputStreamReader(is));
StringBuffer content= new StringBuffer(); StringBuilder content= new StringBuilder(2000);
for(String line= br.readLine(); line!=null; line= br.readLine()) { for(String line= br.readLine(); line!=null; line= br.readLine()) {
content.append(line+"\n"); //$NON-NLS-1$ content.append(line).append('\n');
} }
String[] values= (content.toString()+"dummy-for-split").split("(\\s)*,(\\s)*"); //$NON-NLS-1$ //$NON-NLS-2$ content.append("dummy-for-split"); //$NON-NLS-1$
String[] values= content.toString().split("(\\s)*,(\\s)*"); //$NON-NLS-1$
for(int i=0; i+1<values.length; i+=2) { for(int i=0; i+1<values.length; i+=2) {
temp.add(new GenericDocTag(values[i], values[i+1])); temp.add(new GenericDocTag(values[i], values[i+1]));
} }
@ -63,6 +74,12 @@ public class DoxygenHelper extends AbstractPreferenceInitializer {
} catch(IOException ioe) { } catch(IOException ioe) {
fTags= new GenericDocTag[0]; fTags= new GenericDocTag[0];
CUIPlugin.log(ioe); CUIPlugin.log(ioe);
} finally {
if (is != null) {
try {
is.close();
} catch (IOException exc) {}
}
} }
} }
return fTags; return fTags;
@ -73,9 +90,6 @@ public class DoxygenHelper extends AbstractPreferenceInitializer {
*/ */
@Override @Override
public void initializeDefaultPreferences() { public void initializeDefaultPreferences() {
IPreferenceStore cuis= CUIPlugin.getDefault().getPreferenceStore(); // doxygen colors are now initialized in PreferenceConstants
PreferenceConverter.setDefault(cuis, DoxygenHelper.DOXYGEN_MULTI_TOKEN, new RGB(63, 95, 191));
PreferenceConverter.setDefault(cuis, DoxygenHelper.DOXYGEN_SINGLE_TOKEN, new RGB(63, 95, 191));
PreferenceConverter.setDefault(cuis, DoxygenHelper.DOXYGEN_TAG_RECOGNIZED, new RGB(127, 159, 191));
} }
} }

View file

@ -1,12 +1,12 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2008 Symbian Software Systems and others. * Copyright (c) 2008, 2011 Symbian Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Andrew Ferguson (Symbian) - Initial implementation * Andrew Ferguson (Symbian) - Initial implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.ui.text.doctools.doxygen; package org.eclipse.cdt.ui.text.doctools.doxygen;
@ -15,6 +15,7 @@ import org.eclipse.jface.text.IAutoEditStrategy;
import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IDocument;
import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.ui.PreferenceConstants;
import org.eclipse.cdt.ui.text.doctools.IDocCommentViewerConfiguration; import org.eclipse.cdt.ui.text.doctools.IDocCommentViewerConfiguration;
import org.eclipse.cdt.ui.text.doctools.generic.AbstractGenericTagDocCommentViewerConfiguration; import org.eclipse.cdt.ui.text.doctools.generic.AbstractGenericTagDocCommentViewerConfiguration;
import org.eclipse.cdt.ui.text.doctools.generic.GenericDocTag; import org.eclipse.cdt.ui.text.doctools.generic.GenericDocTag;
@ -29,7 +30,7 @@ public class DoxygenMultilineConfiguration extends AbstractGenericTagDocCommentV
* Default constructor * Default constructor
*/ */
public DoxygenMultilineConfiguration() { public DoxygenMultilineConfiguration() {
super(DoxygenHelper.getDoxygenTags(), new char[] {'@','\\'}, DoxygenHelper.DOXYGEN_MULTI_TOKEN, DoxygenHelper.DOXYGEN_TAG_RECOGNIZED); super(DoxygenHelper.getDoxygenTags(), new char[] {'@','\\'}, PreferenceConstants.DOXYGEN_MULTI_LINE_COLOR, PreferenceConstants.DOXYGEN_TAG_COLOR);
} }
/** /**
@ -47,6 +48,7 @@ public class DoxygenMultilineConfiguration extends AbstractGenericTagDocCommentV
/* /*
* @see org.eclipse.cdt.ui.text.doctools.IDocCommentViewerConfiguration#createAutoEditStrategy() * @see org.eclipse.cdt.ui.text.doctools.IDocCommentViewerConfiguration#createAutoEditStrategy()
*/ */
@Override
public IAutoEditStrategy createAutoEditStrategy() { public IAutoEditStrategy createAutoEditStrategy() {
return new DoxygenMultilineAutoEditStrategy(); return new DoxygenMultilineAutoEditStrategy();
} }
@ -54,6 +56,7 @@ public class DoxygenMultilineConfiguration extends AbstractGenericTagDocCommentV
/* /*
* @see org.eclipse.cdt.ui.text.doctools.IDocCommentViewerConfiguration#isDocumentationComment(org.eclipse.jface.text.IDocument, int, int) * @see org.eclipse.cdt.ui.text.doctools.IDocCommentViewerConfiguration#isDocumentationComment(org.eclipse.jface.text.IDocument, int, int)
*/ */
@Override
public boolean isDocumentationComment(IDocument doc, int offset, int length) { public boolean isDocumentationComment(IDocument doc, int offset, int length) {
try { try {
if(offset+2 < doc.getLength()) { if(offset+2 < doc.getLength()) {

View file

@ -1,12 +1,12 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2008 Symbian Software Systems and others. * Copyright (c) 2008, 2011 Symbian Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Andrew Ferguson (Symbian) - Initial implementation * Andrew Ferguson (Symbian) - Initial implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.ui.text.doctools.doxygen; package org.eclipse.cdt.ui.text.doctools.doxygen;
@ -16,6 +16,7 @@ import org.eclipse.jface.text.IAutoEditStrategy;
import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IDocument;
import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.ui.PreferenceConstants;
import org.eclipse.cdt.ui.text.doctools.IDocCommentViewerConfiguration; import org.eclipse.cdt.ui.text.doctools.IDocCommentViewerConfiguration;
import org.eclipse.cdt.ui.text.doctools.generic.AbstractGenericTagDocCommentViewerConfiguration; import org.eclipse.cdt.ui.text.doctools.generic.AbstractGenericTagDocCommentViewerConfiguration;
import org.eclipse.cdt.ui.text.doctools.generic.GenericDocTag; import org.eclipse.cdt.ui.text.doctools.generic.GenericDocTag;
@ -30,9 +31,9 @@ public class DoxygenSingleConfiguration extends AbstractGenericTagDocCommentView
* Default constructor * Default constructor
*/ */
public DoxygenSingleConfiguration() { public DoxygenSingleConfiguration() {
super(DoxygenHelper.getDoxygenTags(), new char[] {'@','\\'}, DoxygenHelper.DOXYGEN_SINGLE_TOKEN, DoxygenHelper.DOXYGEN_TAG_RECOGNIZED); super(DoxygenHelper.getDoxygenTags(), new char[] {'@','\\'}, PreferenceConstants.DOXYGEN_SINGLE_LINE_COLOR, PreferenceConstants.DOXYGEN_TAG_COLOR);
} }
/** /**
* Constructor intended for use by sub-classes. * Constructor intended for use by sub-classes.
* @param tags a non-null array of tags this configuration should recognize * @param tags a non-null array of tags this configuration should recognize
@ -43,17 +44,19 @@ public class DoxygenSingleConfiguration extends AbstractGenericTagDocCommentView
protected DoxygenSingleConfiguration(GenericDocTag[] tags, char[] tagMarkers, String defaultToken, String tagToken) { protected DoxygenSingleConfiguration(GenericDocTag[] tags, char[] tagMarkers, String defaultToken, String tagToken) {
super(tags, tagMarkers, defaultToken, tagToken); super(tags, tagMarkers, defaultToken, tagToken);
} }
/* /*
* @see org.eclipse.cdt.ui.text.doctools.IDocCommentViewerConfiguration#createAutoEditStrategy() * @see org.eclipse.cdt.ui.text.doctools.IDocCommentViewerConfiguration#createAutoEditStrategy()
*/ */
@Override
public IAutoEditStrategy createAutoEditStrategy() { public IAutoEditStrategy createAutoEditStrategy() {
return new DefaultIndentLineAutoEditStrategy(); return new DefaultIndentLineAutoEditStrategy();
} }
/* /*
* @see org.eclipse.cdt.ui.text.doctools.IDocCommentViewerConfiguration#isDocumentationComment(org.eclipse.jface.text.IDocument, int, int) * @see org.eclipse.cdt.ui.text.doctools.IDocCommentViewerConfiguration#isDocumentationComment(org.eclipse.jface.text.IDocument, int, int)
*/ */
@Override
public boolean isDocumentationComment(IDocument doc, int offset, int length) { public boolean isDocumentationComment(IDocument doc, int offset, int length) {
try { try {
if(offset+2 < doc.getLength()) { if(offset+2 < doc.getLength()) {