1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-16 12:45:41 +02:00

Fix redraw of tree on syntax coloring page when semantic highlighting is disabled

This commit is contained in:
Anton Leherbauer 2008-05-14 13:44:00 +00:00
parent 9cd97af5e5
commit 1ed5637cde

View file

@ -113,8 +113,8 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
fColorKey= colorKey; fColorKey= colorKey;
fBoldKey= boldKey; fBoldKey= boldKey;
fItalicKey= italicKey; fItalicKey= italicKey;
fStrikethroughKey= strikethroughKey; fStrikethroughKey= strikethroughKey;
fUnderlineKey= underlineKey; fUnderlineKey= underlineKey;
} }
/** /**
@ -297,31 +297,31 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
private static final String UNDERLINE= PreferenceConstants.EDITOR_UNDERLINE_SUFFIX; private static final String UNDERLINE= PreferenceConstants.EDITOR_UNDERLINE_SUFFIX;
/** /**
* The keys of the overlay store. * The keys of the overlay store.
*/ */
private final String[][] fSyntaxColorListModel= new String[][] { private final String[][] fSyntaxColorListModel= new String[][] {
{ PreferencesMessages.CEditorColoringConfigurationBlock_MultiLine, PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_COLOR }, { PreferencesMessages.CEditorColoringConfigurationBlock_MultiLine, PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_COLOR },
{ PreferencesMessages.CEditorColoringConfigurationBlock_singleLine, PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_COLOR }, { PreferencesMessages.CEditorColoringConfigurationBlock_singleLine, PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_COLOR },
{ PreferencesMessages.CEditorColoringConfigurationBlock_cCommentTaskTags, PreferenceConstants.EDITOR_TASK_TAG_COLOR }, { PreferencesMessages.CEditorColoringConfigurationBlock_cCommentTaskTags, PreferenceConstants.EDITOR_TASK_TAG_COLOR },
{ PreferencesMessages.CEditorColoringConfigurationBlock_ppDirectives, PreferenceConstants.EDITOR_PP_DIRECTIVE_COLOR }, { PreferencesMessages.CEditorColoringConfigurationBlock_ppDirectives, PreferenceConstants.EDITOR_PP_DIRECTIVE_COLOR },
{ PreferencesMessages.CEditorColoringConfigurationBlock_ppOthers, PreferenceConstants.EDITOR_PP_DEFAULT_COLOR }, { PreferencesMessages.CEditorColoringConfigurationBlock_ppOthers, PreferenceConstants.EDITOR_PP_DEFAULT_COLOR },
{ 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_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 },
{ PreferencesMessages.CEditorColoringConfigurationBlock_operators, PreferenceConstants.EDITOR_C_OPERATOR_COLOR }, { PreferencesMessages.CEditorColoringConfigurationBlock_operators, PreferenceConstants.EDITOR_C_OPERATOR_COLOR },
{ PreferencesMessages.CEditorColoringConfigurationBlock_strings, PreferenceConstants.EDITOR_C_STRING_COLOR }, { PreferencesMessages.CEditorColoringConfigurationBlock_strings, PreferenceConstants.EDITOR_C_STRING_COLOR },
{ PreferencesMessages.CEditorColoringConfigurationBlock_braces, PreferenceConstants.EDITOR_C_BRACES_COLOR }, { PreferencesMessages.CEditorColoringConfigurationBlock_braces, PreferenceConstants.EDITOR_C_BRACES_COLOR },
{ PreferencesMessages.CEditorColoringConfigurationBlock_numbers, PreferenceConstants.EDITOR_C_NUMBER_COLOR }, { PreferencesMessages.CEditorColoringConfigurationBlock_numbers, PreferenceConstants.EDITOR_C_NUMBER_COLOR },
{ PreferencesMessages.CEditorColoringConfigurationBlock_others, PreferenceConstants.EDITOR_C_DEFAULT_COLOR }, { PreferencesMessages.CEditorColoringConfigurationBlock_others, PreferenceConstants.EDITOR_C_DEFAULT_COLOR },
}; };
private final String fCodeCategory= PreferencesMessages.CEditorColoringConfigurationBlock_coloring_category_code; private final String fCodeCategory= PreferencesMessages.CEditorColoringConfigurationBlock_coloring_category_code;
private final String fCommentsCategory= PreferencesMessages.CEditorColoringConfigurationBlock_coloring_category_comments; private final String fCommentsCategory= PreferencesMessages.CEditorColoringConfigurationBlock_coloring_category_comments;
private final String fPreprocessorCategory= PreferencesMessages.CEditorColoringConfigurationBlock_coloring_category_preprocessor; private final String fPreprocessorCategory= PreferencesMessages.CEditorColoringConfigurationBlock_coloring_category_preprocessor;
private final String fAssemblyCategory= PreferencesMessages.CEditorColoringConfigurationBlock_coloring_category_assembly; private final String fAssemblyCategory= PreferencesMessages.CEditorColoringConfigurationBlock_coloring_category_assembly;
private ColorSelector fSyntaxForegroundColorEditor; private ColorSelector fSyntaxForegroundColorEditor;
private Label fColorEditorLabel; private Label fColorEditorLabel;
@ -372,18 +372,18 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
for (String[] element : fSyntaxColorListModel) for (String[] element : fSyntaxColorListModel)
fListModel.add(new HighlightingColorListItem ( fListModel.add(new HighlightingColorListItem (
element[0], element[0],
element[1], element[1],
element[1] + BOLD, element[1] + BOLD,
element[1] + ITALIC, element[1] + ITALIC,
element[1] + STRIKETHROUGH, element[1] + STRIKETHROUGH,
element[1] + UNDERLINE)); element[1] + UNDERLINE));
SemanticHighlighting[] semanticHighlightings= SemanticHighlightings.getSemanticHighlightings(); SemanticHighlighting[] semanticHighlightings= SemanticHighlightings.getSemanticHighlightings();
for (SemanticHighlighting semanticHighlighting : semanticHighlightings) for (SemanticHighlighting semanticHighlighting : semanticHighlightings)
fListModel.add( fListModel.add(
new SemanticHighlightingColorListItem( new SemanticHighlightingColorListItem(
semanticHighlighting.getDisplayName(), semanticHighlighting.getDisplayName(),
SemanticHighlightings.getColorPreferenceKey(semanticHighlighting), SemanticHighlightings.getColorPreferenceKey(semanticHighlighting),
SemanticHighlightings.getBoldPreferenceKey(semanticHighlighting), SemanticHighlightings.getBoldPreferenceKey(semanticHighlighting),
SemanticHighlightings.getItalicPreferenceKey(semanticHighlighting), SemanticHighlightings.getItalicPreferenceKey(semanticHighlighting),
@ -518,7 +518,7 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
return; return;
} }
RGB rgb= PreferenceConverter.getColor(getPreferenceStore(), item.getColorKey()); RGB rgb= PreferenceConverter.getColor(getPreferenceStore(), item.getColorKey());
fSyntaxForegroundColorEditor.setColorValue(rgb); fSyntaxForegroundColorEditor.setColorValue(rgb);
fBoldCheckBox.setSelection(getPreferenceStore().getBoolean(item.getBoldKey())); fBoldCheckBox.setSelection(getPreferenceStore().getBoolean(item.getBoldKey()));
fItalicCheckBox.setSelection(getPreferenceStore().getBoolean(item.getItalicKey())); fItalicCheckBox.setSelection(getPreferenceStore().getBoolean(item.getItalicKey()));
fStrikethroughCheckBox.setSelection(getPreferenceStore().getBoolean(item.getStrikethroughKey())); fStrikethroughCheckBox.setSelection(getPreferenceStore().getBoolean(item.getStrikethroughKey()));
@ -559,12 +559,12 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
link.addSelectionListener(new SelectionAdapter() { link.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
PreferencesUtil.createPreferenceDialogOn(parent.getShell(), e.text, null, null); PreferencesUtil.createPreferenceDialogOn(parent.getShell(), e.text, null, null);
} }
}); });
// TODO replace by link-specific tooltips when // TODO replace by link-specific tooltips when
// bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=88866 gets fixed // bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=88866 gets fixed
// link.setToolTipText(PreferencesMessages.CEditorColoringConfigurationBlock_link_tooltip); // link.setToolTipText(PreferencesMessages.CEditorColoringConfigurationBlock_link_tooltip);
GridData gridData= new GridData(SWT.FILL, SWT.BEGINNING, true, false); GridData gridData= new GridData(SWT.FILL, SWT.BEGINNING, true, false);
gridData.widthHint= 150; // only expand further if anyone else requires it gridData.widthHint= 150; // only expand further if anyone else requires it
@ -573,13 +573,13 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
addFiller(colorComposite, 1); addFiller(colorComposite, 1);
fEnableSemanticHighlightingCheckbox= addCheckBox(colorComposite, fEnableSemanticHighlightingCheckbox= addCheckBox(colorComposite,
PreferencesMessages.CEditorColoringConfigurationBlock_enable_semantic_highlighting, PreferencesMessages.CEditorColoringConfigurationBlock_enable_semantic_highlighting,
PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_ENABLED, 0); PreferenceConstants.EDITOR_SEMANTIC_HIGHLIGHTING_ENABLED, 0);
Label label; Label label;
label= new Label(colorComposite, SWT.LEFT); label= new Label(colorComposite, SWT.LEFT);
label.setText(PreferencesMessages.CEditorColoringConfigurationBlock_coloring_element); label.setText(PreferencesMessages.CEditorColoringConfigurationBlock_coloring_element);
label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Composite editorComposite= new Composite(colorComposite, SWT.NONE); Composite editorComposite= new Composite(colorComposite, SWT.NONE);
@ -589,7 +589,7 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
layout.marginWidth= 0; layout.marginWidth= 0;
editorComposite.setLayout(layout); editorComposite.setLayout(layout);
GridData gd= new GridData(SWT.FILL, SWT.BEGINNING, true, false); GridData gd= new GridData(SWT.FILL, SWT.BEGINNING, true, false);
editorComposite.setLayoutData(gd); editorComposite.setLayoutData(gd);
fListViewer= new TreeViewer(editorComposite, SWT.SINGLE | SWT.BORDER); fListViewer= new TreeViewer(editorComposite, SWT.SINGLE | SWT.BORDER);
fListViewer.setLabelProvider(new ColorListLabelProvider()); fListViewer.setLabelProvider(new ColorListLabelProvider());
@ -631,14 +631,14 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
fEnableCheckbox= new Button(stylesComposite, SWT.CHECK); fEnableCheckbox= new Button(stylesComposite, SWT.CHECK);
fEnableCheckbox.setText(PreferencesMessages.CEditorColoringConfigurationBlock_enable); fEnableCheckbox.setText(PreferencesMessages.CEditorColoringConfigurationBlock_enable);
gd= new GridData(GridData.FILL_HORIZONTAL); gd= new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalAlignment= GridData.BEGINNING; gd.horizontalAlignment= GridData.BEGINNING;
gd.horizontalSpan= 2; gd.horizontalSpan= 2;
fEnableCheckbox.setLayoutData(gd); fEnableCheckbox.setLayoutData(gd);
fColorEditorLabel= new Label(stylesComposite, SWT.LEFT); fColorEditorLabel= new Label(stylesComposite, SWT.LEFT);
fColorEditorLabel.setText(PreferencesMessages.CEditorColoringConfigurationBlock_color); fColorEditorLabel.setText(PreferencesMessages.CEditorColoringConfigurationBlock_color);
gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.horizontalIndent= 20; gd.horizontalIndent= 20;
fColorEditorLabel.setLayoutData(gd); fColorEditorLabel.setLayoutData(gd);
@ -649,35 +649,35 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
foregroundColorButton.setLayoutData(gd); foregroundColorButton.setLayoutData(gd);
fBoldCheckBox= new Button(stylesComposite, SWT.CHECK); fBoldCheckBox= new Button(stylesComposite, SWT.CHECK);
fBoldCheckBox.setText(PreferencesMessages.CEditorColoringConfigurationBlock_bold); fBoldCheckBox.setText(PreferencesMessages.CEditorColoringConfigurationBlock_bold);
gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.horizontalIndent= 20; gd.horizontalIndent= 20;
gd.horizontalSpan= 2; gd.horizontalSpan= 2;
fBoldCheckBox.setLayoutData(gd); fBoldCheckBox.setLayoutData(gd);
fItalicCheckBox= new Button(stylesComposite, SWT.CHECK); fItalicCheckBox= new Button(stylesComposite, SWT.CHECK);
fItalicCheckBox.setText(PreferencesMessages.CEditorColoringConfigurationBlock_italic); fItalicCheckBox.setText(PreferencesMessages.CEditorColoringConfigurationBlock_italic);
gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.horizontalIndent= 20; gd.horizontalIndent= 20;
gd.horizontalSpan= 2; gd.horizontalSpan= 2;
fItalicCheckBox.setLayoutData(gd); fItalicCheckBox.setLayoutData(gd);
fStrikethroughCheckBox= new Button(stylesComposite, SWT.CHECK); fStrikethroughCheckBox= new Button(stylesComposite, SWT.CHECK);
fStrikethroughCheckBox.setText(PreferencesMessages.CEditorColoringConfigurationBlock_strikethrough); fStrikethroughCheckBox.setText(PreferencesMessages.CEditorColoringConfigurationBlock_strikethrough);
gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.horizontalIndent= 20; gd.horizontalIndent= 20;
gd.horizontalSpan= 2; gd.horizontalSpan= 2;
fStrikethroughCheckBox.setLayoutData(gd); fStrikethroughCheckBox.setLayoutData(gd);
fUnderlineCheckBox= new Button(stylesComposite, SWT.CHECK); fUnderlineCheckBox= new Button(stylesComposite, SWT.CHECK);
fUnderlineCheckBox.setText(PreferencesMessages.CEditorColoringConfigurationBlock_underline); fUnderlineCheckBox.setText(PreferencesMessages.CEditorColoringConfigurationBlock_underline);
gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.horizontalIndent= 20; gd.horizontalIndent= 20;
gd.horizontalSpan= 2; gd.horizontalSpan= 2;
fUnderlineCheckBox.setLayoutData(gd); fUnderlineCheckBox.setLayoutData(gd);
label= new Label(colorComposite, SWT.LEFT); label= new Label(colorComposite, SWT.LEFT);
label.setText(PreferencesMessages.CEditorColoringConfigurationBlock_preview); label.setText(PreferencesMessages.CEditorColoringConfigurationBlock_preview);
label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Control previewer= createPreviewer(colorComposite); Control previewer= createPreviewer(colorComposite);
@ -768,9 +768,9 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
// do nothing // do nothing
} }
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
fListViewer.refresh(true);
HighlightingColorListItem item= getHighlightingColorListItem(); HighlightingColorListItem item= getHighlightingColorListItem();
if (item instanceof SemanticHighlightingColorListItem) { if (item instanceof SemanticHighlightingColorListItem) {
fListViewer.refresh(true);
handleSyntaxColorListSelection(); handleSyntaxColorListSelection();
uninstallSemanticHighlighting(); uninstallSemanticHighlighting();
installSemanticHighlighting(); installSemanticHighlighting();