1
/*******************************************************************************
2
* Copyright (c) 2005, 2009 IBM Corporation and others.
3
* All rights reserved. This program and the accompanying materials
4
* are made available under the terms of the Eclipse Public License v1.0
5
* which accompanies this distribution, and is available at
6
* http://www.eclipse.org/legal/epl-v10.html
9
* IBM Corporation - initial API and implementation
11
* Anton Leherbauer (Wind River Systems)
12
* Sergey Prigogin (Google)
13
* Elazar Leibovich (IDF) - Code folding of compound statements (bug 174597)
14
* Jens Elmenthaler (Verigy) - http://bugs.eclipse.org/235586
15
*******************************************************************************/
16
package org.eclipse.cdt.ui;
18
import java.util.Locale;
20
import org.eclipse.core.resources.ProjectScope;
21
import org.eclipse.core.runtime.preferences.DefaultScope;
22
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
23
import org.eclipse.core.runtime.preferences.InstanceScope;
24
import org.eclipse.jface.action.Action;
25
import org.eclipse.jface.preference.IPreferenceStore;
26
import org.eclipse.jface.preference.PreferenceConverter;
27
import org.eclipse.jface.resource.ColorRegistry;
28
import org.eclipse.swt.SWT;
29
import org.eclipse.swt.graphics.RGB;
30
import org.eclipse.ui.PlatformUI;
31
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
33
import org.eclipse.cdt.core.model.ICProject;
34
import org.eclipse.cdt.ui.text.ICColorConstants;
36
import org.eclipse.cdt.internal.ui.ICThemeConstants;
37
import org.eclipse.cdt.internal.ui.preferences.formatter.FormatterProfileManager;
38
import org.eclipse.cdt.internal.ui.text.spelling.SpellCheckEngine;
41
* Preference constants used in the CDT-UI preference store. Clients should only read the
42
* CDT-UI preference store using these values. Clients are not allowed to modify the
43
* preference store programmatically.
45
* @noextend This class is not intended to be subclassed by clients.
46
* @noinstantiate This class is not intended to be instantiated by clients.
49
public class PreferenceConstants {
51
private PreferenceConstants() {
55
* Preference key suffix for bold text style preference keys.
59
public static final String EDITOR_BOLD_SUFFIX= "_bold"; //$NON-NLS-1$
62
* Preference key suffix for italic text style preference keys.
66
public static final String EDITOR_ITALIC_SUFFIX= "_italic"; //$NON-NLS-1$
69
* Preference key suffix for strikethrough text style preference keys.
73
public static final String EDITOR_STRIKETHROUGH_SUFFIX= "_strikethrough"; //$NON-NLS-1$
76
* Preference key suffix for underline text style preference keys.
80
public static final String EDITOR_UNDERLINE_SUFFIX= "_underline"; //$NON-NLS-1$
83
* A named preference that holds the color used to render multi-line comments.
85
* Value is of type <code>String</code>. A RGB color value encoded as a string
86
* using class <code>PreferenceConverter</code>
89
* @see org.eclipse.jface.resource.StringConverter
90
* @see org.eclipse.jface.preference.PreferenceConverter
93
public final static String EDITOR_MULTI_LINE_COMMENT_COLOR= ICColorConstants.C_MULTI_LINE_COMMENT;
96
* A named preference that controls whether multi-line comments are rendered in bold.
98
* Value is of type <code>Boolean</code>. If <code>true</code> multi-line comments are rendered
99
* in bold. If <code>false</code> the are rendered using no font style attribute.
104
public final static String EDITOR_MULTI_LINE_COMMENT_BOLD= ICColorConstants.C_MULTI_LINE_COMMENT + EDITOR_BOLD_SUFFIX;
107
* A named preference that controls whether multi-line comments are rendered in italic.
109
* Value is of type <code>Boolean</code>. If <code>true</code> multi-line comments are rendered
110
* in italic. If <code>false</code> the are rendered using no italic font style attribute.
115
public final static String EDITOR_MULTI_LINE_COMMENT_ITALIC= ICColorConstants.C_MULTI_LINE_COMMENT + EDITOR_ITALIC_SUFFIX;
118
* A named preference that holds the color used to render single line comments.
120
* Value is of type <code>String</code>. A RGB color value encoded as a string
121
* using class <code>PreferenceConverter</code>
124
* @see org.eclipse.jface.resource.StringConverter
125
* @see org.eclipse.jface.preference.PreferenceConverter
128
public final static String EDITOR_SINGLE_LINE_COMMENT_COLOR= ICColorConstants.C_SINGLE_LINE_COMMENT;
131
* A named preference that controls whether single line comments are rendered in bold.
133
* Value is of type <code>Boolean</code>. If <code>true</code> single line comments are rendered
134
* in bold. If <code>false</code> the are rendered using no font style attribute.
139
public final static String EDITOR_SINGLE_LINE_COMMENT_BOLD= ICColorConstants.C_SINGLE_LINE_COMMENT + EDITOR_BOLD_SUFFIX;
142
* A named preference that controls whether single line comments are rendered in italic.
144
* Value is of type <code>Boolean</code>. If <code>true</code> single line comments are rendered
145
* in italic. If <code>false</code> the are rendered using no italic font style attribute.
150
public final static String EDITOR_SINGLE_LINE_COMMENT_ITALIC= ICColorConstants.C_SINGLE_LINE_COMMENT + EDITOR_ITALIC_SUFFIX;
153
* A named preference that holds the color used to render C/C++ keywords.
155
* Value is of type <code>String</code>. A RGB color value encoded as a string
156
* using class <code>PreferenceConverter</code>
159
* @see org.eclipse.jface.resource.StringConverter
160
* @see org.eclipse.jface.preference.PreferenceConverter
163
public final static String EDITOR_C_KEYWORD_COLOR= ICColorConstants.C_KEYWORD;
166
* A named preference that controls whether keywords are rendered in bold.
168
* Value is of type <code>Boolean</code>.
173
public final static String EDITOR_C_KEYWORD_BOLD= ICColorConstants.C_KEYWORD + EDITOR_BOLD_SUFFIX;
176
* A named preference that controls whether keywords are rendered in italic.
178
* Value is of type <code>Boolean</code>.
183
public final static String EDITOR_C_KEYWORD_ITALIC= ICColorConstants.C_KEYWORD + EDITOR_ITALIC_SUFFIX;
186
* A named preference that holds the color used to render preprocessor directives.
188
* Value is of type <code>String</code>. A RGB color value encoded as a string
189
* using class <code>PreferenceConverter</code>
192
* @see org.eclipse.jface.resource.StringConverter
193
* @see org.eclipse.jface.preference.PreferenceConverter
196
public final static String EDITOR_PP_DIRECTIVE_COLOR= ICColorConstants.PP_DIRECTIVE;
199
* A named preference that controls whether preprocessor directives are rendered in bold.
201
* Value is of type <code>Boolean</code>.
206
public final static String EDITOR_PP_DIRECTIVE_BOLD= ICColorConstants.PP_DIRECTIVE + EDITOR_BOLD_SUFFIX;
209
* A named preference that controls whether preprocessor directives are rendered in italic.
211
* Value is of type <code>Boolean</code>.
216
public final static String EDITOR_PP_DIRECTIVE_ITALIC= ICColorConstants.PP_DIRECTIVE + EDITOR_ITALIC_SUFFIX;
219
* A named preference that holds the color used to render headers.
221
* Value is of type <code>String</code>. A RGB color value encoded as a string
222
* using class <code>PreferenceConverter</code>
225
* @see org.eclipse.jface.resource.StringConverter
226
* @see org.eclipse.jface.preference.PreferenceConverter
229
public final static String EDITOR_PP_HEADER_COLOR= ICColorConstants.PP_HEADER;
232
* A named preference that controls whether headers are rendered in bold.
234
* Value is of type <code>Boolean</code>.
239
public final static String EDITOR_PP_HEADER_BOLD= ICColorConstants.PP_HEADER + EDITOR_BOLD_SUFFIX;
242
* A named preference that controls whether number are rendered in italic.
244
* Value is of type <code>Boolean</code>.
249
public final static String EDITOR_PP_HEADER_ITALIC= ICColorConstants.PP_HEADER + EDITOR_ITALIC_SUFFIX;
252
* A named preference that holds the color used to render preprocessor text.
254
* Value is of type <code>String</code>. A RGB color value encoded as a string
255
* using class <code>PreferenceConverter</code>
258
* @see org.eclipse.jface.resource.StringConverter
259
* @see org.eclipse.jface.preference.PreferenceConverter
262
public final static String EDITOR_PP_DEFAULT_COLOR= ICColorConstants.PP_DEFAULT;
265
* A named preference that controls whether preprocessor text is rendered in bold.
267
* Value is of type <code>Boolean</code>.
272
public final static String EDITOR_PP_DEFAULT_BOLD= ICColorConstants.PP_DEFAULT + EDITOR_BOLD_SUFFIX;
275
* A named preference that controls whether preprocessor text is rendered in italic.
277
* Value is of type <code>Boolean</code>.
282
public final static String EDITOR_PP_DEFAULT_ITALIC= ICColorConstants.PP_DEFAULT + EDITOR_ITALIC_SUFFIX;
285
* A named preference that holds the color used to render builtin types.
287
* Value is of type <code>String</code>. A RGB color value encoded as a string
288
* using class <code>PreferenceConverter</code>
291
* @see org.eclipse.jface.resource.StringConverter
292
* @see org.eclipse.jface.preference.PreferenceConverter
295
public final static String EDITOR_C_BUILTIN_TYPE_COLOR= ICColorConstants.C_TYPE;
298
* A named preference that controls whether builtin types are rendered in bold.
300
* Value is of type <code>Boolean</code>.
305
public final static String EDITOR_C_BUILTIN_TYPE_BOLD= ICColorConstants.C_TYPE + EDITOR_BOLD_SUFFIX;
308
* A named preference that controls whether builtin types are rendered in italic.
310
* Value is of type <code>Boolean</code>.
315
public final static String EDITOR_C_BUILTIN_TYPE_ITALIC= ICColorConstants.C_TYPE + EDITOR_ITALIC_SUFFIX;
318
* A named preference that holds the color used to render string constants.
320
* Value is of type <code>String</code>. A RGB color value encoded as a string
321
* using class <code>PreferenceConverter</code>
324
* @see org.eclipse.jface.resource.StringConverter
325
* @see org.eclipse.jface.preference.PreferenceConverter
328
public final static String EDITOR_C_STRING_COLOR= ICColorConstants.C_STRING;
331
* A named preference that controls whether string constants are rendered in bold.
333
* Value is of type <code>Boolean</code>.
338
public final static String EDITOR_C_STRING_BOLD= ICColorConstants.C_STRING + EDITOR_BOLD_SUFFIX;
341
* A named preference that controls whether string constants are rendered in italic.
343
* Value is of type <code>Boolean</code>.
348
public final static String EDITOR_C_STRING_ITALIC= ICColorConstants.C_STRING + EDITOR_ITALIC_SUFFIX;
351
* A named preference that holds the color used to render operators.
353
* Value is of type <code>String</code>. A RGB color value encoded as a string
354
* using class <code>PreferenceConverter</code>
357
* @see org.eclipse.jface.resource.StringConverter
358
* @see org.eclipse.jface.preference.PreferenceConverter
361
public final static String EDITOR_C_OPERATOR_COLOR= ICColorConstants.C_OPERATOR;
364
* A named preference that controls whether operators are rendered in bold.
366
* Value is of type <code>Boolean</code>.
371
public final static String EDITOR_C_OPERATOR_BOLD= ICColorConstants.C_OPERATOR + EDITOR_BOLD_SUFFIX;
374
* A named preference that controls whether operators are rendered in italic.
376
* Value is of type <code>Boolean</code>.
381
public final static String EDITOR_C_OPERATOR_ITALIC= ICColorConstants.C_OPERATOR + EDITOR_ITALIC_SUFFIX;
384
* A named preference that holds the color used to render numbers.
386
* Value is of type <code>String</code>. A RGB color value encoded as a string
387
* using class <code>PreferenceConverter</code>
390
* @see org.eclipse.jface.resource.StringConverter
391
* @see org.eclipse.jface.preference.PreferenceConverter
394
public final static String EDITOR_C_NUMBER_COLOR= ICColorConstants.C_NUMBER;
397
* A named preference that controls whether number are rendered in bold.
399
* Value is of type <code>Boolean</code>.
404
public final static String EDITOR_C_NUMBER_BOLD= ICColorConstants.C_NUMBER + EDITOR_BOLD_SUFFIX;
407
* A named preference that controls whether number are rendered in italic.
409
* Value is of type <code>Boolean</code>.
414
public final static String EDITOR_C_NUMBER_ITALIC= ICColorConstants.C_NUMBER + EDITOR_ITALIC_SUFFIX;
417
* A named preference that holds the color used to render braces.
419
* Value is of type <code>String</code>. A RGB color value encoded as a string
420
* using class <code>PreferenceConverter</code>
423
* @see org.eclipse.jface.resource.StringConverter
424
* @see org.eclipse.jface.preference.PreferenceConverter
427
public final static String EDITOR_C_BRACES_COLOR= ICColorConstants.C_BRACES;
430
* A named preference that controls whether braces are rendered in bold.
432
* Value is of type <code>Boolean</code>.
437
public final static String EDITOR_C_BRACES_BOLD= ICColorConstants.C_BRACES + EDITOR_BOLD_SUFFIX;
440
* A named preference that controls whether braces are rendered in italic.
442
* Value is of type <code>Boolean</code>.
447
public final static String EDITOR_C_BRACES_ITALIC= ICColorConstants.C_BRACES + EDITOR_ITALIC_SUFFIX;
450
* A named preference that holds the color used to render C/C++ default text.
452
* Value is of type <code>String</code>. A RGB color value encoded as a string
453
* using class <code>PreferenceConverter</code>
456
* @see org.eclipse.jface.resource.StringConverter
457
* @see org.eclipse.jface.preference.PreferenceConverter
460
public final static String EDITOR_C_DEFAULT_COLOR= ICColorConstants.C_DEFAULT;
463
* A named preference that controls whether C/C++ default text is rendered in bold.
465
* Value is of type <code>Boolean</code>.
470
public final static String EDITOR_C_DEFAULT_BOLD= ICColorConstants.C_DEFAULT + EDITOR_BOLD_SUFFIX;
473
* A named preference that controls whether C/C++ default text is rendered in italic.
475
* Value is of type <code>Boolean</code>.
480
public final static String EDITOR_C_DEFAULT_ITALIC= ICColorConstants.C_DEFAULT + EDITOR_ITALIC_SUFFIX;
483
* A named preference that holds the color used to render assembly labels.
485
* Value is of type <code>String</code>. A RGB color value encoded as a string
486
* using class <code>PreferenceConverter</code>
489
* @see org.eclipse.jface.resource.StringConverter
490
* @see org.eclipse.jface.preference.PreferenceConverter
493
public final static String EDITOR_ASM_LABEL_COLOR= ICColorConstants.ASM_LABEL;
496
* A named preference that controls whether assembly labels are rendered in bold.
498
* Value is of type <code>Boolean</code>.
503
public final static String EDITOR_ASM_LABEL_BOLD= ICColorConstants.ASM_LABEL + EDITOR_BOLD_SUFFIX;
506
* A named preference that controls whether assembly labels are rendered in italic.
508
* Value is of type <code>Boolean</code>.
513
public final static String EDITOR_ASM_LABEL_ITALIC= ICColorConstants.ASM_LABEL + EDITOR_ITALIC_SUFFIX;
516
* A named preference that holds the color used to render assembly directives.
518
* Value is of type <code>String</code>. A RGB color value encoded as a string
519
* using class <code>PreferenceConverter</code>
522
* @see org.eclipse.jface.resource.StringConverter
523
* @see org.eclipse.jface.preference.PreferenceConverter
526
public final static String EDITOR_ASM_DIRECTIVE_COLOR= ICColorConstants.ASM_DIRECTIVE;
529
* A named preference that controls whether assembly directives are rendered in bold.
531
* Value is of type <code>Boolean</code>.
536
public final static String EDITOR_ASM_DIRECTIVE_BOLD= ICColorConstants.ASM_DIRECTIVE + EDITOR_BOLD_SUFFIX;
539
* A named preference that controls whether assembly directives are rendered in italic.
541
* Value is of type <code>Boolean</code>.
546
public final static String EDITOR_ASM_DIRECTIVE_ITALIC= ICColorConstants.ASM_DIRECTIVE + EDITOR_ITALIC_SUFFIX;
549
* The symbolic font name for the C/C++ editor text font
550
* (value <code>"org.eclipse.cdt.ui.editors.textfont"</code>).
554
public final static String EDITOR_TEXT_FONT= "org.eclipse.cdt.ui.editors.textfont"; //$NON-NLS-1$
557
* A named preference that controls whether the cview's selection is linked to the active editor.
559
* Value is of type <code>Boolean</code>.
562
public static final String PREF_LINK_TO_EDITOR= "org.eclipse.cdt.ui.editor.linkToEditor"; //$NON-NLS-1$
565
* A named preference that speficies whether children of a translation unit are shown in the CView.
567
* Value is of type <code>Boolean</code>.
570
public static final String PREF_SHOW_CU_CHILDREN= "org.eclipse.cdt.ui.editor.CUChildren"; //$NON-NLS-1$
573
* A named preference that speficies whether to use the parser's structural mode to build the CModel.
575
* Value is of type <code>Boolean</code>.
578
public static final String PREF_USE_STRUCTURAL_PARSE_MODE= "org.eclipse.cdt.ui.editor.UseStructuralMode"; //$NON-NLS-1$
581
* A named preference that controls if segmented view (show selected element only) is turned on or off.
583
* Value is of type <code>Boolean</code>.
586
public static final String EDITOR_SHOW_SEGMENTS= "org.eclipse.cdt.ui.editor.showSegments"; //$NON-NLS-1$
589
* A named preference that holds the color used to render task tags.
591
* Value is of type <code>String</code>. A RGB color value encoded as a string
592
* using class <code>PreferenceConverter</code>
595
* @see org.eclipse.jface.resource.StringConverter
596
* @see org.eclipse.jface.preference.PreferenceConverter
598
public final static String EDITOR_TASK_TAG_COLOR= ICColorConstants.TASK_TAG;
601
* A named preference that controls whether task tags are rendered in bold.
603
* Value is of type <code>Boolean</code>.
606
public final static String EDITOR_TASK_TAG_BOLD= ICColorConstants.TASK_TAG + EDITOR_BOLD_SUFFIX;
609
* A named preference that controls whether task tags are rendered in italic.
611
* Value is of type <code>Boolean</code>.
614
public final static String EDITOR_TASK_TAG_ITALIC= ICColorConstants.TASK_TAG + EDITOR_ITALIC_SUFFIX;
617
* A named preference that controls if correction indicators are shown in the UI.
619
* Value is of type <code>Boolean</code>.
622
public final static String EDITOR_CORRECTION_INDICATION= "CEditor.ShowTemporaryProblem"; //$NON-NLS-1$
625
* A named preference that controls if temporary problems are evaluated and shown in the UI.
627
* Value is of type <code>Boolean</code>.
630
public final static String EDITOR_EVALUATE_TEMPORARY_PROBLEMS= "handleTemporaryProblems"; //$NON-NLS-1$
633
* A named preference that defines the key for the hover modifiers.
636
public static final String EDITOR_TEXT_HOVER_MODIFIERS= "hoverModifiers"; //$NON-NLS-1$
639
* A named preference that defines the key for the hover modifier state masks.
640
* The value is only used if the value of <code>EDITOR_TEXT_HOVER_MODIFIERS</code>
641
* cannot be resolved to valid SWT modifier bits.
643
* @see #EDITOR_TEXT_HOVER_MODIFIERS
645
public static final String EDITOR_TEXT_HOVER_MODIFIER_MASKS= "hoverModifierMasks"; //$NON-NLS-1$
648
* A named preference that controls whether the 'close strings' feature
651
* Value is of type <code>Boolean</code>.
654
public final static String EDITOR_CLOSE_STRINGS= "closeStrings"; //$NON-NLS-1$
657
* A named preference that controls whether the 'wrap strings' feature is
660
* Value is of type <code>Boolean</code>.
663
public final static String EDITOR_WRAP_STRINGS= "wrapStrings"; //$NON-NLS-1$
666
* A named preference that controls whether the 'escape strings' feature is
669
* Value is of type <code>Boolean</code>.
672
public final static String EDITOR_ESCAPE_STRINGS= "escapeStrings"; //$NON-NLS-1$
675
* A named preference that controls whether the 'close brackets' feature is
678
* Value is of type <code>Boolean</code>.
681
public final static String EDITOR_CLOSE_BRACKETS= "closeBrackets"; //$NON-NLS-1$
684
* A named preference that controls whether the 'close angular brackets' feature is
687
* Value is of type <code>Boolean</code>.
690
public final static String EDITOR_CLOSE_ANGULAR_BRACKETS= "closeAngularBrackets"; //$NON-NLS-1$
693
* A named preference that controls whether the 'close braces' feature is
696
* Value is of type <code>Boolean</code>.
699
public final static String EDITOR_CLOSE_BRACES= "closeBraces"; //$NON-NLS-1$
702
* A named preference that controls whether the 'smart paste' feature is
705
* Value is of type <code>Boolean</code>.
708
public final static String EDITOR_SMART_PASTE= "smartPaste"; //$NON-NLS-1$
711
* A named preference that controls the smart tab behavior.
713
* Value is of type <code>Boolean</code>.
715
public static final String EDITOR_SMART_TAB= "smart_tab"; //$NON-NLS-1$
718
* A named preference that controls whether the 'auto indent' feature is
721
* Value is of type <code>Boolean</code>.
724
public final static String EDITOR_AUTO_INDENT= "autoIndent"; //$NON-NLS-1$
727
* The id of the best match hover contributed for extension point
728
* <code>org.eclipse.cdt.ui.textHovers</code>.
732
public static final String ID_BESTMATCH_HOVER= "org.eclipse.cdt.ui.BestMatchHover"; //$NON-NLS-1$
735
* A named preference that controls whether the Outline view should group include directives.
737
* Value is of type <code>Boolean</code>.
740
public static final String OUTLINE_GROUP_INCLUDES= "org.eclipse.cdt.ui.outline.groupincludes"; //$NON-NLS-1$
743
* A named preference that controls whether the Outline view should group namespaces.
745
* Value is of type <code>Boolean</code>.
748
public static final String OUTLINE_GROUP_NAMESPACES= "org.eclipse.cdt.ui.outline.groupnamespaces"; //$NON-NLS-1$
751
* A named preference that controls whether the Outline view should group member definitions.
753
* Value is of type <code>Boolean</code>.
757
public static final String OUTLINE_GROUP_MEMBERS= "org.eclipse.cdt.ui.outline.groupmembers"; //$NON-NLS-1$
760
* A named preference that controls whether the Outline view
761
* selection should stay in sync with with the element at the current cursor position.
763
* Value is of type <code>Boolean</code>.
766
public static final String OUTLINE_LINK_TO_EDITOR = "org.eclipse.cdt.ui.outline.linktoeditor"; //$NON-NLS-1$
769
* A named preference that controls whether include directives should be grouped in the
770
* C/C++ Projects view and the Project Explorer view.
772
* Value is of type <code>Boolean</code>.
775
public static final String CVIEW_GROUP_INCLUDES= "org.eclipse.cdt.ui.cview.groupincludes"; //$NON-NLS-1$
778
* A named preference that controls whether header and source files should be separated in the
779
* C/C++ Projects view and the Project Explorer view.
781
* Value is of type <code>Boolean</code>.
786
public static final String CVIEW_SEPARATE_HEADER_AND_SOURCE= "org.eclipse.cdt.ui.cview.separateheaderandsource"; //$NON-NLS-1$
789
* A named preference that controls which completion proposal categories
790
* have been excluded from the default proposal list.
792
* Value is of type <code>String</code>, a "\0"-separated list of identifiers.
797
public static final String CODEASSIST_EXCLUDED_CATEGORIES= "content_assist_disabled_computers"; //$NON-NLS-1$
800
* A named preference that controls the order of the specific code assist commands.
802
* Value is of type <code>String</code>, a "\0"-separated list of identifiers.
807
public static final String CODEASSIST_CATEGORY_ORDER= "content_assist_category_order"; //$NON-NLS-1$
810
* A named preference that controls whether folding is enabled in the C editor.
812
* Value is of type <code>Boolean</code>.
816
public static final String EDITOR_FOLDING_ENABLED= "editor_folding_enabled"; //$NON-NLS-1$
819
* A named preference that stores the configured folding provider.
821
* Value is of type <code>String</code>.
825
public static final String EDITOR_FOLDING_PROVIDER= "editor_folding_provider"; //$NON-NLS-1$
828
* A named preference that stores the value for Structure folding for the default folding provider.
830
* Value is of type <code>Boolean</code>.
835
public static final String EDITOR_FOLDING_STRUCTURES= "editor_folding_default_structures"; //$NON-NLS-1$
838
* A named preference that stores the value for statements folding (if/else, do/while, for, switch statements)
840
* Value is of type <code>Boolean</code>.
843
public static final String EDITOR_FOLDING_STATEMENTS = "editor_folding_statements"; //$NON-NLS-1$
846
* A named preference that stores the value for functions folding for the default folding provider.
848
* Value is of type <code>Boolean</code>.
853
public static final String EDITOR_FOLDING_FUNCTIONS= "editor_folding_default_functions"; //$NON-NLS-1$
856
* A named preference that stores the value for method folding for the default folding provider.
858
* Value is of type <code>Boolean</code>.
863
public static final String EDITOR_FOLDING_METHODS= "editor_folding_default_methods"; //$NON-NLS-1$
866
* A named preference that stores the value for macros folding for the default folding provider.
868
* Value is of type <code>Boolean</code>.
873
public static final String EDITOR_FOLDING_MACROS= "editor_folding_default_macros"; //$NON-NLS-1$
876
* A named preference that stores the value for comment folding for the default folding provider.
878
* Value is of type <code>Boolean</code>.
883
public static final String EDITOR_FOLDING_COMMENTS= "editor_folding_default_comments"; //$NON-NLS-1$
886
* A named preference that stores the value for header comment folding for the default folding provider.
888
* Value is of type <code>Boolean</code>.
893
public static final String EDITOR_FOLDING_HEADERS= "editor_folding_default_headers"; //$NON-NLS-1$
896
* A named preference that stores the value for inactive code folding for the default folding provider.
898
* Value is of type <code>Boolean</code>.
903
public static final String EDITOR_FOLDING_INACTIVE_CODE= "editor_folding_default_inactive"; //$NON-NLS-1$
906
* A named preference that controls whether folding of preprocessor branches is enabled.
908
* Value is of type <code>Boolean</code>.
913
public static final String EDITOR_FOLDING_PREPROCESSOR_BRANCHES_ENABLED= "editor_folding_preprocessor_enabled"; //$NON-NLS-1$
916
* A named preference that controls if templates are formatted when applied.
918
* Value is of type <code>Boolean</code>.
923
public static final String TEMPLATES_USE_CODEFORMATTER= "org.eclipse.cdt.ui.text.templates.format"; //$NON-NLS-1$
926
* A named preference that controls which profile is used by the code formatter.
928
* Value is of type <code>String</code>.
933
public static final String FORMATTER_PROFILE = "formatter_profile"; //$NON-NLS-1$
936
* Preference key for whether to ensure a newline at the end of files when saving.
940
public final static String ENSURE_NEWLINE_AT_EOF = "ensureNewlineAtEOF"; //$NON-NLS-1$
943
* Preference key for whether to remove trailing whitespace when saving.
947
public final static String REMOVE_TRAILING_WHITESPACE = "removeTrailingWhitespace"; //$NON-NLS-1$
950
* Preference key controlling how REMOVE_TRAILING_WHITESPACE option is applied.
951
* If REMOVE_TRAILING_WHITESPACE is enabled, this option limits the scope of
952
* the removal to edited lines only. This option has no effect if
953
* REMOVE_TRAILING_WHITESPACE is disabled.
957
public final static String REMOVE_TRAILING_WHITESPACE_LIMIT_TO_EDITED_LINES = "removeTrailingWhitespaceEditedLines"; //$NON-NLS-1$
960
* A named preference that defines whether the hint to make hover sticky should be shown.
963
* @deprecated As of 4.0, replaced by {@link AbstractDecoratedTextEditorPreferenceConstants#EDITOR_SHOW_TEXT_HOVER_AFFORDANCE}
966
public static final String EDITOR_SHOW_TEXT_HOVER_AFFORDANCE= AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SHOW_TEXT_HOVER_AFFORDANCE;
969
* A named preference prefix for semantic highlighting preferences.
973
public static final String EDITOR_SEMANTIC_HIGHLIGHTING_PREFIX="semanticHighlighting."; //$NON-NLS-1$
976
* A named preference suffix that controls a semantic highlighting's color.
978
* Value is of type <code>String</code>. A RGB color value encoded as a string
979
* using class <code>PreferenceConverter</code>
982
* @see org.eclipse.jface.resource.StringConverter
983
* @see org.eclipse.jface.preference.PreferenceConverter
986
public static final String EDITOR_SEMANTIC_HIGHLIGHTING_COLOR_SUFFIX=".color"; //$NON-NLS-1$
989
* A named preference suffix that controls if semantic highlighting has the text attribute bold.
991
* Value is of type <code>Boolean</code>: <code>true</code> if bold.
996
public static final String EDITOR_SEMANTIC_HIGHLIGHTING_BOLD_SUFFIX=".bold"; //$NON-NLS-1$
999
* A named preference suffix that controls if semantic highlighting has the text attribute italic.
1001
* Value is of type <code>Boolean</code>: <code>true</code> if italic.
1006
public static final String EDITOR_SEMANTIC_HIGHLIGHTING_ITALIC_SUFFIX=".italic"; //$NON-NLS-1$
1009
* A named preference suffix that controls if semantic highlighting has the text attribute strikethrough.
1011
* Value is of type <code>Boolean</code>: <code>true</code> if strikethrough.
1016
public static final String EDITOR_SEMANTIC_HIGHLIGHTING_STRIKETHROUGH_SUFFIX=".strikethrough"; //$NON-NLS-1$
1019
* A named preference suffix that controls if semantic highlighting has the text attribute underline.
1021
* Value is of type <code>Boolean</code>: <code>true</code> if underline.
1026
public static final String EDITOR_SEMANTIC_HIGHLIGHTING_UNDERLINE_SUFFIX=".underline"; //$NON-NLS-1$
1029
* A named preference suffix that controls if semantic highlighting is enabled.
1031
* Value is of type <code>Boolean</code>: <code>true</code> if enabled.
1036
public static final String EDITOR_SEMANTIC_HIGHLIGHTING_ENABLED_SUFFIX=".enabled"; //$NON-NLS-1$
1039
* A named preference key that controls if semantic highlighting is enabled.
1041
* Value is of type <code>Boolean</code>: <code>true</code> if enabled.
1046
public static final String EDITOR_SEMANTIC_HIGHLIGHTING_ENABLED= "semanticHighlighting.enabled"; //$NON-NLS-1$
1049
* A named preference that controls if quick assist light bulbs are shown.
1051
* Value is of type <code>Boolean</code>: if <code>true</code> light bulbs are shown
1052
* for quick assists.
1057
public static final String EDITOR_QUICKASSIST_LIGHTBULB="org.eclipse.cdt.quickassist.lightbulb"; //$NON-NLS-1$
1060
* A named preference that holds the background color used in the code assist selection dialog.
1062
* Value is of type <code>String</code>. A RGB color value encoded as a string
1063
* using class <code>PreferenceConverter</code>
1066
* @see org.eclipse.jface.resource.StringConverter
1067
* @see org.eclipse.jface.preference.PreferenceConverter
1071
public final static String CODEASSIST_PROPOSALS_BACKGROUND= "content_assist_proposals_background"; //$NON-NLS-1$
1073
* A named preference that holds the foreground color used in the code assist selection dialog.
1075
* Value is of type <code>String</code>. A RGB color value encoded as a string
1076
* using class <code>PreferenceConverter</code>
1079
* @see org.eclipse.jface.resource.StringConverter
1080
* @see org.eclipse.jface.preference.PreferenceConverter
1084
public final static String CODEASSIST_PROPOSALS_FOREGROUND= "content_assist_proposals_foreground"; //$NON-NLS-1$
1087
* A named preference that holds the background color used for parameter hints.
1089
* Value is of type <code>String</code>. A RGB color value encoded as a string
1090
* using class <code>PreferenceConverter</code>
1093
* @see org.eclipse.jface.resource.StringConverter
1094
* @see org.eclipse.jface.preference.PreferenceConverter
1098
public final static String CODEASSIST_PARAMETERS_BACKGROUND= "content_assist_parameters_background"; //$NON-NLS-1$
1101
* A named preference that holds the foreground color used in the code assist selection dialog.
1103
* Value is of type <code>String</code>. A RGB color value encoded as a string
1104
* using class <code>PreferenceConverter</code>
1107
* @see org.eclipse.jface.resource.StringConverter
1108
* @see org.eclipse.jface.preference.PreferenceConverter
1112
public final static String CODEASSIST_PARAMETERS_FOREGROUND= "content_assist_parameters_foreground"; //$NON-NLS-1$
1115
* A named preference that controls whether words containing digits should
1116
* be skipped during spell checking.
1118
* Value is of type <code>Boolean</code>.
1123
public final static String SPELLING_IGNORE_DIGITS= "spelling_ignore_digits"; //$NON-NLS-1$
1126
* A named preference that controls whether mixed case words should be
1127
* skipped during spell checking.
1129
* Value is of type <code>Boolean</code>.
1134
public final static String SPELLING_IGNORE_MIXED= "spelling_ignore_mixed"; //$NON-NLS-1$
1137
* A named preference that controls whether sentence capitalization should
1138
* be ignored during spell checking.
1140
* Value is of type <code>Boolean</code>.
1145
public final static String SPELLING_IGNORE_SENTENCE= "spelling_ignore_sentence"; //$NON-NLS-1$
1148
* A named preference that controls whether upper case words should be
1149
* skipped during spell checking.
1151
* Value is of type <code>Boolean</code>.
1156
public final static String SPELLING_IGNORE_UPPER= "spelling_ignore_upper"; //$NON-NLS-1$
1159
* A named preference that controls whether URLs should be ignored during
1162
* Value is of type <code>Boolean</code>.
1167
public final static String SPELLING_IGNORE_URLS= "spelling_ignore_urls"; //$NON-NLS-1$
1170
* A named preference that controls whether single letters
1171
* should be ignored during spell checking.
1173
* Value is of type <code>Boolean</code>.
1178
public final static String SPELLING_IGNORE_SINGLE_LETTERS= "spelling_ignore_single_letters"; //$NON-NLS-1$
1181
* A named preference that controls whether string literals
1182
* should be ignored during spell checking.
1184
* Value is of type <code>Boolean</code>.
1189
public final static String SPELLING_IGNORE_STRING_LITERALS= "spelling_ignore_string_literals"; //$NON-NLS-1$
1192
* A named preference that controls whether non-letters at word boundaries
1193
* should be ignored during spell checking.
1195
* Value is of type <code>Boolean</code>.
1200
public final static String SPELLING_IGNORE_NON_LETTERS= "spelling_ignore_non_letters"; //$NON-NLS-1$
1203
* A named preference that controls the locale used for spell checking.
1205
* Value is of type <code>String</code>.
1210
public final static String SPELLING_LOCALE= "spelling_locale"; //$NON-NLS-1$
1213
* A named preference that controls the number of proposals offered during
1216
* Value is of type <code>Integer</code>.
1221
public final static String SPELLING_PROPOSAL_THRESHOLD= "spelling_proposal_threshold"; //$NON-NLS-1$
1224
* A named preference that controls the maximum number of problems reported
1225
* during spell checking.
1227
* Value is of type <code>Integer</code>.
1232
public final static String SPELLING_PROBLEMS_THRESHOLD= "spelling_problems_threshold"; //$NON-NLS-1$
1235
* A named preference that specifies the workspace user dictionary.
1237
* Value is of type <code>Integer</code>.
1242
public final static String SPELLING_USER_DICTIONARY= "spelling_user_dictionary"; //$NON-NLS-1$
1245
* A named preference that specifies encoding of the workspace user dictionary.
1247
* Value is of type <code>String</code>.
1252
public final static String SPELLING_USER_DICTIONARY_ENCODING= "spelling_user_dictionary_encoding"; //$NON-NLS-1$
1255
* A named preference that specifies whether spelling dictionaries are available to content assist.
1257
* <strong>Note:</strong> This is currently not supported because the spelling engine
1258
* cannot return word proposals but only correction proposals.
1260
* Value is of type <code>Boolean</code>.
1265
public final static String SPELLING_ENABLE_CONTENTASSIST= "spelling_enable_contentassist"; //$NON-NLS-1$
1268
* A named preference that controls if documentation comment stubs will be added
1269
* automatically to newly created types and methods.
1271
* Value is of type <code>Boolean</code>.
1275
public static final String CODEGEN_ADD_COMMENTS= "org.eclipse.cdt.ui.add_comments"; //$NON-NLS-1$
1278
* A named preference that holds the source hover background color.
1280
* Value is of type <code>String</code>. A RGB color value encoded as a string
1281
* using class <code>PreferenceConverter</code>
1284
* @see org.eclipse.jface.resource.StringConverter
1285
* @see org.eclipse.jface.preference.PreferenceConverter
1288
public final static String EDITOR_SOURCE_HOVER_BACKGROUND_COLOR= "sourceHoverBackgroundColor"; //$NON-NLS-1$
1291
* A named preference that tells whether to use the system
1292
* default color ({@link SWT#COLOR_INFO_BACKGROUND}) for
1293
* the source hover background color.
1295
* Value is of type <code>Boolean</code>.
1298
* @see org.eclipse.jface.resource.StringConverter
1299
* @see org.eclipse.jface.preference.PreferenceConverter
1302
public final static String EDITOR_SOURCE_HOVER_BACKGROUND_COLOR_SYSTEM_DEFAULT= "sourceHoverBackgroundColor.SystemDefault"; //$NON-NLS-1$
1305
* A named preference that controls whether occurrences are marked in the editor.
1307
* Value is of type <code>Boolean</code>.
1312
public static final String EDITOR_MARK_OCCURRENCES= "markOccurrences"; //$NON-NLS-1$
1316
* A named preference that controls whether occurrences are sticky in the editor.
1318
* Value is of type <code>Boolean</code>.
1323
public static final String EDITOR_STICKY_OCCURRENCES= "stickyOccurrences"; //$NON-NLS-1$
1326
* A named preference that controls whether all scalability mode options should be turned on.
1328
* Value is of type <code>Boolean</code>.
1333
public static final String SCALABILITY_ENABLE_ALL = "scalability.enableAll"; //$NON-NLS-1$
1336
* A named preference that controls whether the editor's reconciler is disabled.
1338
* Value is of type <code>Boolean</code>.
1343
public static final String SCALABILITY_RECONCILER = "scalability.reconciler"; //$NON-NLS-1$
1346
* A named preference that controls whether syntax coloring is disabled.
1348
* Value is of type <code>Boolean</code>.
1353
public static final String SCALABILITY_SYNTAX_COLOR = "scalability.syntaxColor"; //$NON-NLS-1$
1356
* A named preference that controls whether parser-based content assist proposals are disabled.
1358
* Value is of type <code>Boolean</code>.
1363
public static final String SCALABILITY_PARSER_BASED_CONTENT_ASSIST = "scalability.parserBasedContentAssist"; //$NON-NLS-1$
1366
* A named preference that controls whether users should be notified if scalability mode should be turned on.
1368
* Value is of type <code>Boolean</code>.
1373
public static final String SCALABILITY_ALERT = "scalability.detect"; //$NON-NLS-1$
1376
* The size of the file that will trigger scalability mode
1378
* Value is of type <code>int</code>.
1383
public static final String SCALABILITY_NUMBER_OF_LINES = "scalability.numberOfLines"; //$NON-NLS-1$
1386
* A named preference that controls whether syntax coloring is disabled.
1388
* Value is of type <code>Boolean</code>.
1393
public static final String SCALABILITY_SEMANTIC_HIGHLIGHT = "scalability.semanticHighlight"; //$NON-NLS-1$
1396
* A named preference that controls whether the content assist auto activation is disabled in scalability mode.
1398
* Value is of type <code>Boolean</code>.
1403
public static final String SCALABILITY_CONTENT_ASSIST_AUTO_ACTIVATION = "scalability.contentAssistAutoActivation"; //$NON-NLS-1$
1406
* A named preference that controls how an include guard symbol is created.
1408
* Value is of type <code>Integer</code>.
1413
public static final String CODE_TEMPLATES_INCLUDE_GUARD_SCHEME = "codetemplates.includeGuardGenerationScheme"; //$NON-NLS-1$
1416
* The value of <code>CODE_TEMPLATES_INCLUDE_GUARD_GENERATION_SCHEME</code>
1417
* specifying that the include guard symbol is to be derived from the
1418
* include file's name.
1422
public static final int CODE_TEMPLATES_INCLUDE_GUARD_SCHEME_FILE_NAME = 0;
1425
* The value of <code>CODE_TEMPLATES_INCLUDE_GUARD_GENERATION_SCHEME</code>
1426
* specifying that the include guard symbol is to be derived from a UUID.
1430
public static final int CODE_TEMPLATES_INCLUDE_GUARD_SCHEME_UUID = 1;
1433
* Returns the CDT-UI preference store.
1435
* @return the CDT-UI preference store
1437
public static IPreferenceStore getPreferenceStore() {
1438
return CUIPlugin.getDefault().getPreferenceStore();
1442
* Initializes the given preference store with the default values.
1444
* @param store the preference store to be initialized
1446
public static void initializeDefaultValues(IPreferenceStore store) {
1447
ColorRegistry registry= PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry();
1449
store.setDefault(PreferenceConstants.EDITOR_CORRECTION_INDICATION, false);
1450
store.setDefault(PreferenceConstants.EDITOR_SHOW_SEGMENTS, false);
1451
store.setDefault(PreferenceConstants.PREF_SHOW_CU_CHILDREN, true);
1453
// This option has to be turned on for the spelling checker too work.
1454
// As of 4.0, it doesn't produce false positives any more.
1455
store.setDefault(PreferenceConstants.EDITOR_EVALUATE_TEMPORARY_PROBLEMS, true);
1457
int sourceHoverModifier= SWT.MOD2;
1458
String sourceHoverModifierName= Action.findModifierString(sourceHoverModifier); // Shift
1459
store.setDefault(PreferenceConstants.EDITOR_TEXT_HOVER_MODIFIERS, "org.eclipse.cdt.ui.BestMatchHover;0;org.eclipse.cdt.ui.CSourceHover;" + sourceHoverModifierName); //$NON-NLS-1$
1460
store.setDefault(PreferenceConstants.EDITOR_TEXT_HOVER_MODIFIER_MASKS, "org.eclipse.cdt.ui.BestMatchHover;0;org.eclipse.cdt.ui.CSourceHover;" + sourceHoverModifier); //$NON-NLS-1$
1462
store.setDefault(EDITOR_SOURCE_HOVER_BACKGROUND_COLOR_SYSTEM_DEFAULT, true);
1465
PreferenceConverter.setDefault(store, EDITOR_MULTI_LINE_COMMENT_COLOR, new RGB(63, 127, 95));
1466
store.setDefault(EDITOR_MULTI_LINE_COMMENT_BOLD, false);
1467
store.setDefault(EDITOR_MULTI_LINE_COMMENT_ITALIC, false);
1469
PreferenceConverter.setDefault(store, EDITOR_SINGLE_LINE_COMMENT_COLOR, new RGB(63, 127, 95));
1470
store.setDefault(EDITOR_SINGLE_LINE_COMMENT_BOLD, false);
1471
store.setDefault(EDITOR_SINGLE_LINE_COMMENT_ITALIC, false);
1473
PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_TASK_TAG_COLOR, new RGB(127, 159, 191));
1474
store.setDefault(PreferenceConstants.EDITOR_TASK_TAG_BOLD, true);
1475
store.setDefault(PreferenceConstants.EDITOR_TASK_TAG_ITALIC, false);
1477
PreferenceConverter.setDefault(store, EDITOR_C_KEYWORD_COLOR, new RGB(127, 0, 85));
1478
store.setDefault(EDITOR_C_KEYWORD_BOLD, true);
1479
store.setDefault(EDITOR_C_KEYWORD_ITALIC, false);
1481
PreferenceConverter.setDefault(store, EDITOR_C_BUILTIN_TYPE_COLOR, new RGB(127, 0, 85));
1482
store.setDefault(EDITOR_C_BUILTIN_TYPE_BOLD, true);
1483
store.setDefault(EDITOR_C_BUILTIN_TYPE_ITALIC, false);
1485
PreferenceConverter.setDefault(store, EDITOR_C_STRING_COLOR, new RGB(42, 0, 255));
1486
store.setDefault(EDITOR_C_STRING_BOLD, false);
1487
store.setDefault(EDITOR_C_STRING_ITALIC, false);
1489
PreferenceConverter.setDefault(store, EDITOR_C_DEFAULT_COLOR, new RGB(0, 0, 0));
1490
store.setDefault(EDITOR_C_DEFAULT_BOLD, false);
1491
store.setDefault(EDITOR_C_DEFAULT_ITALIC, false);
1493
PreferenceConverter.setDefault(store, EDITOR_C_OPERATOR_COLOR, new RGB(0, 0, 0));
1494
store.setDefault(EDITOR_C_OPERATOR_BOLD, false);
1495
store.setDefault(EDITOR_C_OPERATOR_ITALIC, false);
1497
PreferenceConverter.setDefault(store, EDITOR_C_BRACES_COLOR, new RGB(0, 0, 0));
1498
store.setDefault(EDITOR_C_BRACES_BOLD, false);
1499
store.setDefault(EDITOR_C_BRACES_ITALIC, false);
1501
PreferenceConverter.setDefault(store, EDITOR_C_NUMBER_COLOR, new RGB(0, 0, 0));
1502
store.setDefault(EDITOR_C_NUMBER_BOLD, false);
1503
store.setDefault(EDITOR_C_NUMBER_ITALIC, false);
1505
PreferenceConverter.setDefault(store, EDITOR_PP_DIRECTIVE_COLOR, new RGB(127, 0, 85));
1506
store.setDefault(EDITOR_PP_DIRECTIVE_BOLD, true);
1507
store.setDefault(EDITOR_PP_DIRECTIVE_ITALIC, false);
1509
PreferenceConverter.setDefault(store, EDITOR_PP_HEADER_COLOR, new RGB(42, 0, 255));
1510
store.setDefault(EDITOR_PP_HEADER_BOLD, false);
1511
store.setDefault(EDITOR_PP_HEADER_ITALIC, false);
1513
PreferenceConverter.setDefault(store, EDITOR_PP_DEFAULT_COLOR, new RGB(0, 0, 0));
1514
store.setDefault(EDITOR_PP_DEFAULT_BOLD, false);
1515
store.setDefault(EDITOR_PP_DEFAULT_ITALIC, false);
1517
PreferenceConverter.setDefault(store, EDITOR_ASM_LABEL_COLOR, new RGB(127, 0, 85));
1518
store.setDefault(EDITOR_ASM_LABEL_BOLD, true);
1519
store.setDefault(EDITOR_ASM_LABEL_ITALIC, false);
1521
PreferenceConverter.setDefault(store, EDITOR_ASM_DIRECTIVE_COLOR, new RGB(127, 0, 85));
1522
store.setDefault(EDITOR_ASM_DIRECTIVE_BOLD, true);
1523
store.setDefault(EDITOR_ASM_DIRECTIVE_ITALIC, false);
1526
store.setDefault(PreferenceConstants.EDITOR_FOLDING_ENABLED, false);
1527
store.setDefault(PreferenceConstants.EDITOR_FOLDING_PROVIDER, "org.eclipse.cdt.ui.text.defaultFoldingProvider"); //$NON-NLS-1$
1528
store.setDefault(PreferenceConstants.EDITOR_FOLDING_FUNCTIONS, false);
1529
store.setDefault(PreferenceConstants.EDITOR_FOLDING_STRUCTURES, true);
1530
store.setDefault(PreferenceConstants.EDITOR_FOLDING_METHODS, false);
1531
store.setDefault(PreferenceConstants.EDITOR_FOLDING_MACROS, true);
1532
store.setDefault(PreferenceConstants.EDITOR_FOLDING_COMMENTS, false);
1533
store.setDefault(PreferenceConstants.EDITOR_FOLDING_HEADERS, true);
1534
store.setDefault(PreferenceConstants.EDITOR_FOLDING_INACTIVE_CODE, true);
1535
store.setDefault(PreferenceConstants.EDITOR_FOLDING_PREPROCESSOR_BRANCHES_ENABLED, false);
1538
store.setDefault(PreferenceConstants.EDITOR_CLOSE_STRINGS, true);
1539
store.setDefault(PreferenceConstants.EDITOR_CLOSE_BRACKETS, true);
1540
store.setDefault(PreferenceConstants.EDITOR_CLOSE_ANGULAR_BRACKETS, true);
1541
store.setDefault(PreferenceConstants.EDITOR_CLOSE_BRACES, true);
1542
store.setDefault(PreferenceConstants.EDITOR_SMART_PASTE, true);
1543
store.setDefault(PreferenceConstants.EDITOR_SMART_TAB, true);
1544
store.setDefault(PreferenceConstants.EDITOR_WRAP_STRINGS, true);
1545
store.setDefault(PreferenceConstants.EDITOR_ESCAPE_STRINGS, false);
1546
store.setDefault(PreferenceConstants.EDITOR_AUTO_INDENT, true);
1548
store.setDefault(PreferenceConstants.REMOVE_TRAILING_WHITESPACE, true);
1549
store.setDefault(PreferenceConstants.REMOVE_TRAILING_WHITESPACE_LIMIT_TO_EDITED_LINES, true);
1550
store.setDefault(PreferenceConstants.ENSURE_NEWLINE_AT_EOF, true);
1552
// formatter profile
1553
store.setDefault(PreferenceConstants.FORMATTER_PROFILE, FormatterProfileManager.DEFAULT_PROFILE);
1556
store.setDefault(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES, "org.eclipse.cdt.ui.textProposalCategory\0"); //$NON-NLS-1$
1557
store.setDefault(PreferenceConstants.CODEASSIST_CATEGORY_ORDER, "org.eclipse.cdt.ui.parserProposalCategory:65539\0org.eclipse.cdt.ui.textProposalCategory:65541\0org.eclipse.cdt.ui.templateProposalCategory:2\0org.eclipse.cdt.ui.helpProposalCategory:5\0"); //$NON-NLS-1$
1559
setDefaultAndFireEvent(
1561
PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND,
1562
findRGB(registry, ICThemeConstants.CODEASSIST_PROPOSALS_BACKGROUND, new RGB(255, 255, 255)));
1563
setDefaultAndFireEvent(
1565
PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND,
1566
findRGB(registry, ICThemeConstants.CODEASSIST_PROPOSALS_FOREGROUND, new RGB(0, 0, 0)));
1567
setDefaultAndFireEvent(
1569
PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND,
1570
findRGB(registry, ICThemeConstants.CODEASSIST_PARAMETERS_BACKGROUND, new RGB(255, 255, 255)));
1571
setDefaultAndFireEvent(
1573
PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND,
1574
findRGB(registry, ICThemeConstants.CODEASSIST_PARAMETERS_FOREGROUND, new RGB(0, 0, 0)));
1577
store.setDefault(PreferenceConstants.SPELLING_LOCALE, "en_US"); //$NON-NLS-1$
1578
String isInitializedKey= "spelling_locale_initialized"; //$NON-NLS-1$
1579
if (!store.getBoolean(isInitializedKey)) {
1580
store.setValue(isInitializedKey, true);
1581
Locale locale= SpellCheckEngine.getDefaultLocale();
1582
locale= SpellCheckEngine.findClosestLocale(locale);
1584
store.setValue(PreferenceConstants.SPELLING_LOCALE, locale.toString());
1586
store.setDefault(PreferenceConstants.SPELLING_IGNORE_DIGITS, true);
1587
store.setDefault(PreferenceConstants.SPELLING_IGNORE_MIXED, true);
1588
store.setDefault(PreferenceConstants.SPELLING_IGNORE_SENTENCE, true);
1589
store.setDefault(PreferenceConstants.SPELLING_IGNORE_UPPER, true);
1590
store.setDefault(PreferenceConstants.SPELLING_IGNORE_URLS, true);
1591
store.setDefault(PreferenceConstants.SPELLING_IGNORE_SINGLE_LETTERS, true);
1592
store.setDefault(PreferenceConstants.SPELLING_IGNORE_STRING_LITERALS, false);
1593
store.setDefault(PreferenceConstants.SPELLING_IGNORE_NON_LETTERS, true);
1594
store.setDefault(PreferenceConstants.SPELLING_USER_DICTIONARY, ""); //$NON-NLS-1$
1596
// Note: For backwards compatibility we must use the property and not the workspace default
1597
store.setDefault(PreferenceConstants.SPELLING_USER_DICTIONARY_ENCODING,
1598
System.getProperty("file.encoding")); //$NON-NLS-1$
1600
store.setDefault(PreferenceConstants.SPELLING_PROPOSAL_THRESHOLD, 20);
1601
store.setDefault(PreferenceConstants.SPELLING_PROBLEMS_THRESHOLD, 100);
1603
* XXX: This is currently disabled because the spelling engine
1604
* cannot return word proposals but only correction proposals.
1606
store.setToDefault(PreferenceConstants.SPELLING_ENABLE_CONTENTASSIST);
1609
store.setDefault(PreferenceConstants.CODEGEN_ADD_COMMENTS, false);
1612
store.setDefault(PreferenceConstants.EDITOR_MARK_OCCURRENCES, true);
1613
store.setDefault(PreferenceConstants.EDITOR_STICKY_OCCURRENCES, true);
1616
store.setDefault(PreferenceConstants.SCALABILITY_ALERT, true);
1617
store.setDefault(PreferenceConstants.SCALABILITY_NUMBER_OF_LINES, 5000);
1618
store.setDefault(PreferenceConstants.SCALABILITY_ENABLE_ALL, false);
1619
store.setDefault(PreferenceConstants.SCALABILITY_RECONCILER, true);
1620
store.setDefault(PreferenceConstants.SCALABILITY_SYNTAX_COLOR, false);
1621
store.setDefault(PreferenceConstants.SCALABILITY_SEMANTIC_HIGHLIGHT, false);
1622
store.setDefault(PreferenceConstants.SCALABILITY_PARSER_BASED_CONTENT_ASSIST, false);
1623
store.setDefault(PreferenceConstants.SCALABILITY_CONTENT_ASSIST_AUTO_ACTIVATION, false);
1626
store.setDefault(PreferenceConstants.CODE_TEMPLATES_INCLUDE_GUARD_SCHEME,
1627
CODE_TEMPLATES_INCLUDE_GUARD_SCHEME_FILE_NAME);
1631
* Returns the node in the preference in the given context.
1632
* @param key The preference key.
1633
* @param project The current context or <code>null</code> if no context is available and the
1634
* workspace setting should be taken. Note that passing <code>null</code> should
1636
* @return Returns the node matching the given context.
1638
private static IEclipsePreferences getPreferenceNode(String key, ICProject project) {
1639
IEclipsePreferences node = null;
1641
if (project != null) {
1642
node = new ProjectScope(project.getProject()).getNode(CUIPlugin.PLUGIN_ID);
1643
if (node.get(key, null) != null) {
1647
node = new InstanceScope().getNode(CUIPlugin.PLUGIN_ID);
1648
if (node.get(key, null) != null) {
1652
return new DefaultScope().getNode(CUIPlugin.PLUGIN_ID);
1656
* Returns the string value for the given key in the given context.
1657
* @param key The preference key
1658
* @param project The current context or <code>null</code> if no context is available and the
1659
* workspace setting should be taken. Note that passing <code>null</code> should
1661
* @return Returns the current value for the string.
1664
public static String getPreference(String key, ICProject project) {
1665
return getPreferenceNode(key, project).get(key, null);
1669
* Returns the integer value for the given key in the given context.
1670
* @param key The preference key
1671
* @param project The current context or <code>null</code> if no context is available and the
1672
* workspace setting should be taken. Note that passing <code>null</code> should
1674
* @param defaultValue The default value if not specified in the preferences.
1675
* @return Returns the current value for the string.
1678
public static int getPreference(String key, ICProject project, int defaultValue) {
1679
return getPreferenceNode(key, project).getInt(key, defaultValue);
1683
* Returns the boolean value for the given key in the given context.
1684
* @param key The preference key
1685
* @param project The current context or <code>null</code> if no context is available and the
1686
* workspace setting should be taken. Note that passing <code>null</code> should
1688
* @param defaultValue The default value if not specified in the preferences.
1689
* @return Returns the current value for the string.
1692
public static boolean getPreference(String key, ICProject project, boolean defaultValue) {
1693
return getPreferenceNode(key, project).getBoolean(key, defaultValue);
1697
* Sets the default value and fires a property
1698
* change event if necessary.
1700
* @param store the preference store
1701
* @param key the preference key
1702
* @param newValue the new value
1705
private static void setDefaultAndFireEvent(IPreferenceStore store, String key, RGB newValue) {
1707
if (store.isDefault(key))
1708
oldValue= PreferenceConverter.getDefaultColor(store, key);
1710
PreferenceConverter.setDefault(store, key, newValue);
1712
if (oldValue != null && !oldValue.equals(newValue))
1713
store.firePropertyChangeEvent(key, oldValue, newValue);
1717
* Returns the RGB for the given key in the given color registry.
1719
* @param registry the color registry
1720
* @param key the key for the constant in the registry
1721
* @param defaultRGB the default RGB if no entry is found
1722
* @return RGB the RGB
1725
private static RGB findRGB(ColorRegistry registry, String key, RGB defaultRGB) {
1726
RGB rgb= registry.getRGB(key);