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

Fix for 194312: Hover Background Color

This commit is contained in:
Anton Leherbauer 2007-12-12 13:34:28 +00:00
parent eff6754c12
commit 1d3da89cf0
8 changed files with 415 additions and 278 deletions

View file

@ -572,8 +572,8 @@
contentTypeId="org.eclipse.cdt.core.binaryFile"> contentTypeId="org.eclipse.cdt.core.binaryFile">
</contentTypeBinding> </contentTypeBinding>
</editor> </editor>
</extension> </extension>
<extension <extension
point="org.eclipse.ui.themes"> point="org.eclipse.ui.themes">
<themeElementCategory label="%CPresentation.label" id="org.eclipse.cdt.ui.presentation"/> <themeElementCategory label="%CPresentation.label" id="org.eclipse.cdt.ui.presentation"/>
@ -614,8 +614,51 @@
%asmCompareFontDefiniton.description %asmCompareFontDefiniton.description
</description> </description>
</fontDefinition> </fontDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.content_assist_proposals_background"
isEditable="false"
label="%Dummy.label"
value="255,255,255">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.content_assist_proposals_foreground"
isEditable="false"
label="%Dummy.label"
value="0,0,0">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.content_assist_parameters_background"
isEditable="false"
label="%Dummy.label"
value="255,255,255">
</colorDefinition>
<colorDefinition
id="org.eclipse.cdt.ui.content_assist_parameters_foreground"
isEditable="false"
label="%Dummy.label"
value="0,0,0">
</colorDefinition>
<theme
id="org.eclipse.ui.ide.systemDefault">
<colorOverride
id="org.eclipse.cdt.ui.content_assist_proposals_background"
value="COLOR_LIST_BACKGROUND">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.content_assist_proposals_foreground"
value="COLOR_LIST_FOREGROUND">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.content_assist_parameters_background"
value="COLOR_LIST_BACKGROUND">
</colorOverride>
<colorOverride
id="org.eclipse.cdt.ui.content_assist_parameters_foreground"
value="COLOR_LIST_FOREGROUND">
</colorOverride>
</theme>
</extension> </extension>
<extension <extension
point="org.eclipse.ui.preferencePages"> point="org.eclipse.ui.preferencePages">
<page <page

View file

@ -29,4 +29,15 @@ public interface ICThemeConstants {
* A theme constant that holds the foreground color used in the code assist selection dialog. * A theme constant that holds the foreground color used in the code assist selection dialog.
*/ */
public final String CODEASSIST_PROPOSALS_FOREGROUND= ID_PREFIX + PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND; public final String CODEASSIST_PROPOSALS_FOREGROUND= ID_PREFIX + PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND;
/**
* A theme constant that holds the background color used for parameter hints.
*/
public final String CODEASSIST_PARAMETERS_BACKGROUND= ID_PREFIX + PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND;
/**
* A theme constant that holds the foreground color used for parameter hints.
*/
public final String CODEASSIST_PARAMETERS_FOREGROUND= ID_PREFIX + PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND;
} }

View file

@ -47,13 +47,14 @@ import org.eclipse.cdt.internal.ui.text.contentassist.ContentAssistPreference;
*/ */
public class CEditorPreferencePage extends AbstractPreferencePage implements IWorkbenchPreferencePage { public class CEditorPreferencePage extends AbstractPreferencePage implements IWorkbenchPreferencePage {
protected final String[][] fAppearanceColorListModel = new String[][] { protected final String[][] fAppearanceColorListModel = new String[][] {
{PreferencesMessages.CEditorPreferencePage_behaviorPage_matchingBracketColor, CEditor.MATCHING_BRACKETS_COLOR, null }, {PreferencesMessages.CEditorPreferencePage_behaviorPage_matchingBracketColor, CEditor.MATCHING_BRACKETS_COLOR, null },
{PreferencesMessages.CEditorPreferencePage_behaviorPage_inactiveCodeColor, CEditor.INACTIVE_CODE_COLOR, null }, {PreferencesMessages.CEditorPreferencePage_behaviorPage_inactiveCodeColor, CEditor.INACTIVE_CODE_COLOR, null },
{PreferencesMessages.CEditorPreferencePage_ContentAssistPage_completionProposalBackgroundColor, ContentAssistPreference.PROPOSALS_BACKGROUND, null }, {PreferencesMessages.CEditorPreferencePage_ContentAssistPage_completionProposalBackgroundColor, ContentAssistPreference.PROPOSALS_BACKGROUND, null },
{PreferencesMessages.CEditorPreferencePage_ContentAssistPage_completionProposalForegroundColor, ContentAssistPreference.PROPOSALS_FOREGROUND, null }, {PreferencesMessages.CEditorPreferencePage_ContentAssistPage_completionProposalForegroundColor, ContentAssistPreference.PROPOSALS_FOREGROUND, null },
{PreferencesMessages.CEditorPreferencePage_ContentAssistPage_parameterBackgroundColor, ContentAssistPreference.PARAMETERS_BACKGROUND, null }, {PreferencesMessages.CEditorPreferencePage_ContentAssistPage_parameterBackgroundColor, ContentAssistPreference.PARAMETERS_BACKGROUND, null },
{PreferencesMessages.CEditorPreferencePage_ContentAssistPage_parameterForegroundColor, ContentAssistPreference.PARAMETERS_FOREGROUND, null }, {PreferencesMessages.CEditorPreferencePage_ContentAssistPage_parameterForegroundColor, ContentAssistPreference.PARAMETERS_FOREGROUND, null },
{PreferencesMessages.CEditorPreferencePage_sourceHoverBackgroundColor, PreferenceConstants.EDITOR_SOURCE_HOVER_BACKGROUND_COLOR, PreferenceConstants.EDITOR_SOURCE_HOVER_BACKGROUND_COLOR_SYSTEM_DEFAULT},
}; };
private List fAppearanceColorList; private List fAppearanceColorList;
@ -67,7 +68,7 @@ public class CEditorPreferencePage extends AbstractPreferencePage implements IWo
protected OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys() { protected OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys() {
ArrayList overlayKeys = new ArrayList(); ArrayList overlayKeys = new ArrayList();
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, CEditor.SUB_WORD_NAVIGATION)); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, CEditor.SUB_WORD_NAVIGATION));
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, CEditor.MATCHING_BRACKETS_COLOR)); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, CEditor.MATCHING_BRACKETS_COLOR));
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, CEditor.MATCHING_BRACKETS)); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, CEditor.MATCHING_BRACKETS));
@ -78,7 +79,9 @@ public class CEditorPreferencePage extends AbstractPreferencePage implements IWo
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, ContentAssistPreference.PROPOSALS_FOREGROUND)); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, ContentAssistPreference.PROPOSALS_FOREGROUND));
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, ContentAssistPreference.PARAMETERS_BACKGROUND)); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, ContentAssistPreference.PARAMETERS_BACKGROUND));
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, ContentAssistPreference.PARAMETERS_FOREGROUND)); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, ContentAssistPreference.PARAMETERS_FOREGROUND));
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_SOURCE_HOVER_BACKGROUND_COLOR));
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SOURCE_HOVER_BACKGROUND_COLOR_SYSTEM_DEFAULT));
OverlayPreferenceStore.OverlayKey[] keys = new OverlayPreferenceStore.OverlayKey[overlayKeys.size()]; OverlayPreferenceStore.OverlayKey[] keys = new OverlayPreferenceStore.OverlayKey[overlayKeys.size()];
overlayKeys.toArray(keys); overlayKeys.toArray(keys);
return keys; return keys;
@ -86,24 +89,19 @@ public class CEditorPreferencePage extends AbstractPreferencePage implements IWo
public static void initDefaults(IPreferenceStore store) { public static void initDefaults(IPreferenceStore store) {
store.setDefault(CEditor.SUB_WORD_NAVIGATION, true); store.setDefault(CEditor.SUB_WORD_NAVIGATION, true);
store.setDefault(CEditor.MATCHING_BRACKETS, true); store.setDefault(CEditor.MATCHING_BRACKETS, true);
PreferenceConverter.setDefault(store, CEditor.MATCHING_BRACKETS_COLOR, new RGB(170,170,170)); PreferenceConverter.setDefault(store, CEditor.MATCHING_BRACKETS_COLOR, new RGB(170,170,170));
store.setDefault(CEditor.INACTIVE_CODE_ENABLE, true); store.setDefault(CEditor.INACTIVE_CODE_ENABLE, true);
PreferenceConverter.setDefault(store, CEditor.INACTIVE_CODE_COLOR, new RGB(224, 224, 224)); PreferenceConverter.setDefault(store, CEditor.INACTIVE_CODE_COLOR, new RGB(224, 224, 224));
PreferenceConverter.setDefault(store, ContentAssistPreference.PROPOSALS_BACKGROUND, new RGB(254, 241, 233));
PreferenceConverter.setDefault(store, ContentAssistPreference.PROPOSALS_FOREGROUND, new RGB(0, 0, 0));
PreferenceConverter.setDefault(store, ContentAssistPreference.PARAMETERS_BACKGROUND, new RGB(254, 241, 233));
PreferenceConverter.setDefault(store, ContentAssistPreference.PARAMETERS_FOREGROUND, new RGB(0, 0, 0));
} }
/* /*
* @see PreferencePage#createControl(Composite) * @see PreferencePage#createControl(Composite)
*/ */
public void createControl(Composite parent) { public void createControl(Composite parent) {
super.createControl(parent); super.createControl(parent);
PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), ICHelpContextIds.C_EDITOR_PREF_PAGE); PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), ICHelpContextIds.C_EDITOR_PREF_PAGE);
} }
@ -125,16 +123,16 @@ public class CEditorPreferencePage extends AbstractPreferencePage implements IWo
layout.numColumns = 2; layout.numColumns = 2;
behaviorComposite.setLayout(layout); behaviorComposite.setLayout(layout);
String label= PreferencesMessages.CEditorPreferencePage_behaviorPage_subWordNavigation; String label= PreferencesMessages.CEditorPreferencePage_behaviorPage_subWordNavigation;
addCheckBox(behaviorComposite, label, CEditor.SUB_WORD_NAVIGATION, 0); addCheckBox(behaviorComposite, label, CEditor.SUB_WORD_NAVIGATION, 0);
label = PreferencesMessages.CEditorPreferencePage_behaviorPage_matchingBrackets; label = PreferencesMessages.CEditorPreferencePage_behaviorPage_matchingBrackets;
addCheckBox(behaviorComposite, label, CEditor.MATCHING_BRACKETS, 0); addCheckBox(behaviorComposite, label, CEditor.MATCHING_BRACKETS, 0);
label = PreferencesMessages.CEditorPreferencePage_behaviorPage_inactiveCode; label = PreferencesMessages.CEditorPreferencePage_behaviorPage_inactiveCode;
addCheckBox(behaviorComposite, label, CEditor.INACTIVE_CODE_ENABLE, 0); addCheckBox(behaviorComposite, label, CEditor.INACTIVE_CODE_ENABLE, 0);
label = PreferencesMessages.CEditorPreferencePage_behaviorPage_ensureNewline; label = PreferencesMessages.CEditorPreferencePage_behaviorPage_ensureNewline;
addCheckBox(behaviorComposite, label, PreferenceConstants.ENSURE_NEWLINE_AT_EOF, 0); addCheckBox(behaviorComposite, label, PreferenceConstants.ENSURE_NEWLINE_AT_EOF, 0);
Label l = new Label(behaviorComposite, SWT.LEFT); Label l = new Label(behaviorComposite, SWT.LEFT);
@ -144,7 +142,7 @@ public class CEditorPreferencePage extends AbstractPreferencePage implements IWo
l.setLayoutData(gd); l.setLayoutData(gd);
l = new Label(behaviorComposite, SWT.LEFT); l = new Label(behaviorComposite, SWT.LEFT);
l.setText(PreferencesMessages.CEditorPreferencePage_behaviorPage_appearanceColorOptions); l.setText(PreferencesMessages.CEditorPreferencePage_behaviorPage_appearanceColorOptions);
gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gd.horizontalSpan = 2; gd.horizontalSpan = 2;
l.setLayoutData(gd); l.setLayoutData(gd);
@ -173,7 +171,7 @@ public class CEditorPreferencePage extends AbstractPreferencePage implements IWo
stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
l = new Label(stylesComposite, SWT.LEFT); l = new Label(stylesComposite, SWT.LEFT);
l.setText(PreferencesMessages.CEditorPreferencePage_behaviorPage_Color); l.setText(PreferencesMessages.CEditorPreferencePage_behaviorPage_Color);
gd = new GridData(); gd = new GridData();
gd.horizontalAlignment = GridData.BEGINNING; gd.horizontalAlignment = GridData.BEGINNING;
l.setLayoutData(gd); l.setLayoutData(gd);
@ -188,16 +186,16 @@ public class CEditorPreferencePage extends AbstractPreferencePage implements IWo
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
boolean systemDefault= fAppearanceColorDefault.getSelection(); boolean systemDefault= fAppearanceColorDefault.getSelection();
fAppearanceColorEditor.getButton().setEnabled(!systemDefault); fAppearanceColorEditor.getButton().setEnabled(!systemDefault);
int i= fAppearanceColorList.getSelectionIndex(); int i= fAppearanceColorList.getSelectionIndex();
String key= fAppearanceColorListModel[i][2]; String key= fAppearanceColorListModel[i][2];
if (key != null) if (key != null)
fOverlayStore.setValue(key, systemDefault); fOverlayStore.setValue(key, systemDefault);
} }
}; };
fAppearanceColorDefault= new Button(stylesComposite, SWT.CHECK); fAppearanceColorDefault= new Button(stylesComposite, SWT.CHECK);
fAppearanceColorDefault.setText(PreferencesMessages.CEditorPreferencePage_colorPage_systemDefault); fAppearanceColorDefault.setText(PreferencesMessages.CEditorPreferencePage_colorPage_systemDefault);
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;
@ -243,7 +241,7 @@ public class CEditorPreferencePage extends AbstractPreferencePage implements IWo
} }
private Control createHeader(Composite parent) { private Control createHeader(Composite parent) {
String text = PreferencesMessages.CEditorPreferencePage_link; String text = PreferencesMessages.CEditorPreferencePage_link;
Link link = new Link(parent, SWT.NONE); Link link = new Link(parent, SWT.NONE);
link.setText(text); link.setText(text);
link.addListener (SWT.Selection, new Listener () { link.addListener (SWT.Selection, new Listener () {
@ -254,7 +252,7 @@ public class CEditorPreferencePage extends AbstractPreferencePage implements IWo
}); });
// 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.CEditorPreferencePage_link_tooltip); link.setToolTipText(PreferencesMessages.CEditorPreferencePage_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
@ -266,7 +264,6 @@ public class CEditorPreferencePage extends AbstractPreferencePage implements IWo
* @see PreferencePage#createContents(Composite) * @see PreferencePage#createContents(Composite)
*/ */
protected Control createContents(Composite parent) { protected Control createContents(Composite parent) {
fOverlayStore.load(); fOverlayStore.load();
fOverlayStore.start(); fOverlayStore.start();
@ -280,8 +277,8 @@ public class CEditorPreferencePage extends AbstractPreferencePage implements IWo
} }
private void initialize() { private void initialize() {
initializeFields(); initializeFields();
initializeDefaultColors();
for (int i = 0; i < fAppearanceColorListModel.length; i++) { for (int i = 0; i < fAppearanceColorListModel.length; i++) {
fAppearanceColorList.add(fAppearanceColorListModel[i][0]); fAppearanceColorList.add(fAppearanceColorListModel[i][0]);
@ -292,14 +289,16 @@ public class CEditorPreferencePage extends AbstractPreferencePage implements IWo
handleAppearanceColorListSelection(); handleAppearanceColorListSelection();
} }
}); });
} }
/* /**
* @see org.eclipse.cdt.internal.ui.preferences.AbstractPreferencePage#performOk() * Initializes the default colors.
*/ */
public boolean performOk() { private void initializeDefaultColors() {
return super.performOk(); if (getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SOURCE_HOVER_BACKGROUND_COLOR_SYSTEM_DEFAULT)) {
RGB rgb= fAppearanceColorList.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND).getRGB();
PreferenceConverter.setValue(getPreferenceStore(), PreferenceConstants.EDITOR_SOURCE_HOVER_BACKGROUND_COLOR, rgb);
}
} }
/* /*
@ -307,15 +306,8 @@ public class CEditorPreferencePage extends AbstractPreferencePage implements IWo
*/ */
protected void performDefaults() { protected void performDefaults() {
super.performDefaults(); super.performDefaults();
initializeDefaultColors();
handleAppearanceColorListSelection(); handleAppearanceColorListSelection();
} }
/*
* @see org.eclipse.cdt.internal.ui.preferences.AbstractPreferencePage#dispose()
*/
public void dispose() {
super.dispose();
}
} }

View file

@ -57,6 +57,7 @@ public final class PreferencesMessages extends NLS {
public static String CEditorPreferencePage_ContentAssistPage_parameterForegroundColor; public static String CEditorPreferencePage_ContentAssistPage_parameterForegroundColor;
public static String CEditorPreferencePage_ContentAssistPage_autoActivationEnableDoubleColon; public static String CEditorPreferencePage_ContentAssistPage_autoActivationEnableDoubleColon;
public static String CEditorPreferencePage_ContentAssistPage_sortingSection_title; public static String CEditorPreferencePage_ContentAssistPage_sortingSection_title;
public static String CEditorPreferencePage_sourceHoverBackgroundColor;
public static String CEditorColoringConfigurationBlock_MultiLine; public static String CEditorColoringConfigurationBlock_MultiLine;
public static String CEditorColoringConfigurationBlock_singleLine; public static String CEditorColoringConfigurationBlock_singleLine;
public static String CEditorColoringConfigurationBlock_keywords; public static String CEditorColoringConfigurationBlock_keywords;
@ -195,7 +196,7 @@ public final class PreferencesMessages extends NLS {
public static String SmartTypingConfigurationBlock_strings_title; public static String SmartTypingConfigurationBlock_strings_title;
public static String CodeFormatterPreferencePage_title; public static String CodeFormatterPreferencePage_title;
public static String CodeFormatterPreferencePage_description; public static String CodeFormatterPreferencePage_description;
public static String TodoTaskPreferencePage_title; public static String TodoTaskPreferencePage_title;
public static String TodoTaskPreferencePage_description; public static String TodoTaskPreferencePage_description;
@ -211,7 +212,7 @@ public final class PreferencesMessages extends NLS {
public static String TodoTaskConfigurationBlock_casesensitive_label; public static String TodoTaskConfigurationBlock_casesensitive_label;
public static String TodoTaskConfigurationBlock_needsbuild_title; public static String TodoTaskConfigurationBlock_needsbuild_title;
public static String TodoTaskConfigurationBlock_tasks_default; public static String TodoTaskConfigurationBlock_tasks_default;
public static String TodoTaskInputDialog_new_title; public static String TodoTaskInputDialog_new_title;
public static String TodoTaskInputDialog_edit_title; public static String TodoTaskInputDialog_edit_title;
public static String TodoTaskInputDialog_name_label; public static String TodoTaskInputDialog_name_label;
@ -255,11 +256,11 @@ public final class PreferencesMessages extends NLS {
public static String SpellingPreferencePage_variables; public static String SpellingPreferencePage_variables;
public static String LanguageMappings_missingLanguageTitle; public static String LanguageMappings_missingLanguageTitle;
public static String WorkspaceLanguagesPreferencePage_description; public static String WorkspaceLanguagesPreferencePage_description;
public static String WorkspaceLanguagesPreferencePage_missingLanguage; public static String WorkspaceLanguagesPreferencePage_missingLanguage;
public static String WorkspaceLanguagesPreferencePage_mappingTableTitle; public static String WorkspaceLanguagesPreferencePage_mappingTableTitle;
public static String ProjectLanguagesPropertyPage_description; public static String ProjectLanguagesPropertyPage_description;
public static String ProjectLanguagesPropertyPage_configurationColumn; public static String ProjectLanguagesPropertyPage_configurationColumn;
public static String ProjectLanguagesPropertyPage_contentTypeColumn; public static String ProjectLanguagesPropertyPage_contentTypeColumn;
@ -270,13 +271,13 @@ public final class PreferencesMessages extends NLS {
public static String ProjectLanguagesPropertyPage_overriddenContentType; public static String ProjectLanguagesPropertyPage_overriddenContentType;
public static String ProjectLanguagesPropertyPage_missingLanguage; public static String ProjectLanguagesPropertyPage_missingLanguage;
public static String ProjectLanguagesPropertyPage_mappingTableTitle; public static String ProjectLanguagesPropertyPage_mappingTableTitle;
public static String ContentTypeMappingsDialog_title; public static String ContentTypeMappingsDialog_title;
public static String ContentTypeMappingsDialog_configuration; public static String ContentTypeMappingsDialog_configuration;
public static String ContentTypeMappingsDialog_contentType; public static String ContentTypeMappingsDialog_contentType;
public static String ContentTypeMappingsDialog_language; public static String ContentTypeMappingsDialog_language;
public static String ContentTypeMappingsDialog_allConfigurations; public static String ContentTypeMappingsDialog_allConfigurations;
public static String FileLanguagesPropertyPage_languageLabel; public static String FileLanguagesPropertyPage_languageLabel;
public static String FileLanguagesPropertyPage_inheritedProjectMappingsGroup; public static String FileLanguagesPropertyPage_inheritedProjectMappingsGroup;
public static String FileLanguagesPropertyPage_contentTypeLabel; public static String FileLanguagesPropertyPage_contentTypeLabel;
@ -289,7 +290,7 @@ public final class PreferencesMessages extends NLS {
public static String FileLanguagesPropertyPage_defaultMapping; public static String FileLanguagesPropertyPage_defaultMapping;
public static String FileLanguagesPropertyPage_missingLanguage; public static String FileLanguagesPropertyPage_missingLanguage;
public static String FileLanguagesPropertyPage_mappingTableTitle; public static String FileLanguagesPropertyPage_mappingTableTitle;
public static String CPluginPreferencePage_caption; public static String CPluginPreferencePage_caption;
public static String CPluginPreferencePage_structuralParseMode_label; public static String CPluginPreferencePage_structuralParseMode_label;
public static String CPluginPreferencePage_note; public static String CPluginPreferencePage_note;

View file

@ -39,6 +39,7 @@ CEditorPreferencePage_ContentAssistPage_parameterBackgroundColor=Parameter hint
CEditorPreferencePage_ContentAssistPage_parameterForegroundColor=Parameter hint foreground CEditorPreferencePage_ContentAssistPage_parameterForegroundColor=Parameter hint foreground
CEditorPreferencePage_ContentAssistPage_autoActivationEnableDoubleColon=Enable "::" as trigger CEditorPreferencePage_ContentAssistPage_autoActivationEnableDoubleColon=Enable "::" as trigger
CEditorPreferencePage_ContentAssistPage_sortingSection_title=Sorting and Filtering CEditorPreferencePage_ContentAssistPage_sortingSection_title=Sorting and Filtering
CEditorPreferencePage_sourceHoverBackgroundColor=Source hover background
# {0} will be replaced by the keyboard shortcut for the command (e.g. "Ctrl+Space", or "no shortcut") # {0} will be replaced by the keyboard shortcut for the command (e.g. "Ctrl+Space", or "no shortcut")
CodeAssistAdvancedConfigurationBlock_page_description=Configure the behavior of the content assist ({0}) command. CodeAssistAdvancedConfigurationBlock_page_description=Configure the behavior of the content assist ({0}) command.

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2002, 2006 QNX Software Systems and others. * Copyright (c) 2002, 2007 QNX 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
@ -13,6 +13,7 @@
package org.eclipse.cdt.internal.ui.text.c.hover; package org.eclipse.cdt.internal.ui.text.c.hover;
import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.jface.resource.JFaceResources; import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.text.Document; import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IDocument;
@ -31,6 +32,7 @@ import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData; import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.layout.GridLayout;
@ -41,6 +43,7 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.cdt.ui.CUIPlugin; 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.internal.ui.editor.CSourceViewer; import org.eclipse.cdt.internal.ui.editor.CSourceViewer;
import org.eclipse.cdt.internal.ui.text.CTextTools; import org.eclipse.cdt.internal.ui.text.CTextTools;
@ -48,12 +51,12 @@ import org.eclipse.cdt.internal.ui.text.SimpleCSourceViewerConfiguration;
/** /**
* SourceViewerInformationControl * SourceViewerInformationControl
* Source viewer based implementation of <code>IInformationControl</code>. * Source viewer based implementation of <code>IInformationControl</code>.
* Displays information in a source viewer. * Displays information in a source viewer.
* *
*/ */
public class SourceViewerInformationControl implements IInformationControl, IInformationControlExtension, DisposeListener { public class SourceViewerInformationControl implements IInformationControl, IInformationControlExtension, DisposeListener {
/** Border thickness in pixels. */ /** Border thickness in pixels. */
private static final int BORDER= 1; private static final int BORDER= 1;
/** The control's shell */ /** The control's shell */
@ -61,22 +64,22 @@ public class SourceViewerInformationControl implements IInformationControl, IInf
/** The control's text widget */ /** The control's text widget */
private StyledText fText; private StyledText fText;
/** The control's source viewer */ /** The control's source viewer */
private SourceViewer fViewer; private SourceViewer fViewer;
/** /**
* The optional status field. * The optional status field.
* *
* @since 3.0 * @since 3.0
*/ */
private Label fStatusField; private Label fStatusField;
/** /**
* The separator for the optional status field. * The separator for the optional status field.
* *
* @since 3.0 * @since 3.0
*/ */
private Label fSeparator; private Label fSeparator;
/** /**
* The font of the optional status text label. * The font of the optional status text label.
* *
* @since 3.0 * @since 3.0
*/ */
private Font fStatusTextFont; private Font fStatusTextFont;
@ -90,12 +93,15 @@ public class SourceViewerInformationControl implements IInformationControl, IInf
* @since 4.0 * @since 4.0
*/ */
private int fMaxHeight= SWT.DEFAULT; private int fMaxHeight= SWT.DEFAULT;
private Color fBackgroundColor;
private boolean fIsSystemBackgroundColor= true;
/** /**
* Creates a default information control with the given shell as parent. The given * Creates a default information control with the given shell as parent. The given
* information presenter is used to process the information to be displayed. The given * information presenter is used to process the information to be displayed. The given
* styles are applied to the created styled text widget. * styles are applied to the created styled text widget.
* *
* @param parent the parent shell * @param parent the parent shell
* @param shellStyle the additional styles for the shell * @param shellStyle the additional styles for the shell
* @param style the additional styles for the styled text widget * @param style the additional styles for the styled text widget
@ -103,12 +109,12 @@ public class SourceViewerInformationControl implements IInformationControl, IInf
public SourceViewerInformationControl(Shell parent, int shellStyle, int style) { public SourceViewerInformationControl(Shell parent, int shellStyle, int style) {
this(parent, shellStyle, style, null); this(parent, shellStyle, style, null);
} }
/** /**
* Creates a default information control with the given shell as parent. The given * Creates a default information control with the given shell as parent. The given
* information presenter is used to process the information to be displayed. The given * information presenter is used to process the information to be displayed. The given
* styles are applied to the created styled text widget. * styles are applied to the created styled text widget.
* *
* @param parent the parent shell * @param parent the parent shell
* @param shellStyle the additional styles for the shell * @param shellStyle the additional styles for the shell
* @param style the additional styles for the styled text widget * @param style the additional styles for the styled text widget
@ -121,9 +127,11 @@ public class SourceViewerInformationControl implements IInformationControl, IInf
GridData gd; GridData gd;
fShell= new Shell(parent, SWT.NO_FOCUS | SWT.ON_TOP | shellStyle); fShell= new Shell(parent, SWT.NO_FOCUS | SWT.ON_TOP | shellStyle);
Display display= fShell.getDisplay(); Display display= fShell.getDisplay();
fShell.setBackground(display.getSystemColor(SWT.COLOR_BLACK)); fShell.setBackground(display.getSystemColor(SWT.COLOR_BLACK));
initializeColors();
Composite composite= fShell; Composite composite= fShell;
layout= new GridLayout(1, false); layout= new GridLayout(1, false);
int border= ((shellStyle & SWT.NO_TRIM) == 0) ? 0 : BORDER; int border= ((shellStyle & SWT.NO_TRIM) == 0) ? 0 : BORDER;
@ -142,31 +150,31 @@ public class SourceViewerInformationControl implements IInformationControl, IInf
gd= new GridData(GridData.FILL_BOTH); gd= new GridData(GridData.FILL_BOTH);
composite.setLayoutData(gd); composite.setLayoutData(gd);
composite.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND)); composite.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
composite.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); composite.setBackground(fBackgroundColor);
} }
// Source viewer // Source viewer
IPreferenceStore store= CUIPlugin.getDefault().getCombinedPreferenceStore(); IPreferenceStore store= CUIPlugin.getDefault().getCombinedPreferenceStore();
fViewer= new CSourceViewer(composite, null, null, false, style, store); fViewer= new CSourceViewer(composite, null, null, false, style, store);
CTextTools tools= CUIPlugin.getDefault().getTextTools(); CTextTools tools= CUIPlugin.getDefault().getTextTools();
fViewer.configure(new SimpleCSourceViewerConfiguration(tools.getColorManager(), store, null, tools.getDocumentPartitioning(), false)); fViewer.configure(new SimpleCSourceViewerConfiguration(tools.getColorManager(), store, null, ICPartitions.C_PARTITIONING, false));
fViewer.setEditable(false); fViewer.setEditable(false);
fText= fViewer.getTextWidget(); fText= fViewer.getTextWidget();
gd= new GridData(GridData.BEGINNING | GridData.FILL_BOTH); gd= new GridData(GridData.BEGINNING | GridData.FILL_BOTH);
fText.setLayoutData(gd); fText.setLayoutData(gd);
fText.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND)); fText.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
fText.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); fText.setBackground(fBackgroundColor);
initializeFont(); initializeFont();
fText.addKeyListener(new KeyListener() { fText.addKeyListener(new KeyListener() {
public void keyPressed(KeyEvent e) { public void keyPressed(KeyEvent e) {
if (e.character == 0x1B) // ESC if (e.character == 0x1B) // ESC
fShell.dispose(); fShell.dispose();
} }
public void keyReleased(KeyEvent e) {} public void keyReleased(KeyEvent e) {}
}); });
@ -191,45 +199,62 @@ public class SourceViewerInformationControl implements IInformationControl, IInf
// Regarding the color see bug 41128 // Regarding the color see bug 41128
fStatusField.setForeground(display.getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW)); fStatusField.setForeground(display.getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW));
fStatusField.setBackground(fBackgroundColor);
fStatusField.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
} }
addDisposeListener(this); addDisposeListener(this);
} }
private void initializeColors() {
RGB bgRGB= getHoverBackgroundColorRGB();
if (bgRGB != null) {
fBackgroundColor= new Color(fShell.getDisplay(), bgRGB);
fIsSystemBackgroundColor= false;
} else {
fBackgroundColor= fShell.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND);
fIsSystemBackgroundColor= true;
}
}
private RGB getHoverBackgroundColorRGB() {
IPreferenceStore store= CUIPlugin.getDefault().getPreferenceStore();
return store.getBoolean(PreferenceConstants.EDITOR_SOURCE_HOVER_BACKGROUND_COLOR_SYSTEM_DEFAULT)
? null
: PreferenceConverter.getColor(store, PreferenceConstants.EDITOR_SOURCE_HOVER_BACKGROUND_COLOR);
}
/** /**
* Creates a default information control with the given shell as parent. The given * Creates a default information control with the given shell as parent. The given
* information presenter is used to process the information to be displayed. The given * information presenter is used to process the information to be displayed. The given
* styles are applied to the created styled text widget. * styles are applied to the created styled text widget.
* *
* @param parent the parent shell * @param parent the parent shell
* @param style the additional styles for the styled text widget * @param style the additional styles for the styled text widget
*/ */
public SourceViewerInformationControl(Shell parent,int style) { public SourceViewerInformationControl(Shell parent,int style) {
this(parent, SWT.NO_TRIM, style); this(parent, SWT.NO_TRIM | SWT.TOOL, style);
} }
/** /**
* Creates a default information control with the given shell as parent. The given * Creates a default information control with the given shell as parent. The given
* information presenter is used to process the information to be displayed. The given * information presenter is used to process the information to be displayed. The given
* styles are applied to the created styled text widget. * styles are applied to the created styled text widget.
* *
* @param parent the parent shell * @param parent the parent shell
* @param style the additional styles for the styled text widget * @param style the additional styles for the styled text widget
* @param statusFieldText the text to be used in the optional status field * @param statusFieldText the text to be used in the optional status field
* or <code>null</code> if the status field should be hidden * or <code>null</code> if the status field should be hidden
* @since 3.0 * @since 3.0
*/ */
public SourceViewerInformationControl(Shell parent,int style, String statusFieldText) { public SourceViewerInformationControl(Shell parent,int style, String statusFieldText) {
this(parent, SWT.NO_TRIM, style, statusFieldText); this(parent, SWT.NO_TRIM | SWT.TOOL, style, statusFieldText);
} }
/** /**
* Creates a default information control with the given shell as parent. * Creates a default information control with the given shell as parent.
* No information presenter is used to process the information * No information presenter is used to process the information
* to be displayed. No additional styles are applied to the styled text widget. * to be displayed. No additional styles are applied to the styled text widget.
* *
* @param parent the parent shell * @param parent the parent shell
*/ */
public SourceViewerInformationControl(Shell parent) { public SourceViewerInformationControl(Shell parent) {
@ -240,7 +265,7 @@ public class SourceViewerInformationControl implements IInformationControl, IInf
* Creates a default information control with the given shell as parent. * Creates a default information control with the given shell as parent.
* No information presenter is used to process the information * No information presenter is used to process the information
* to be displayed. No additional styles are applied to the styled text widget. * to be displayed. No additional styles are applied to the styled text widget.
* *
* @param parent the parent shell * @param parent the parent shell
* @param statusFieldText the text to be used in the optional status field * @param statusFieldText the text to be used in the optional status field
* or <code>null</code> if the status field should be hidden * or <code>null</code> if the status field should be hidden
@ -249,10 +274,10 @@ public class SourceViewerInformationControl implements IInformationControl, IInf
public SourceViewerInformationControl(Shell parent, String statusFieldText) { public SourceViewerInformationControl(Shell parent, String statusFieldText) {
this(parent, SWT.NONE, statusFieldText); this(parent, SWT.NONE, statusFieldText);
} }
/** /**
* Initialize the font to the editor font. * Initialize the font to the editor font.
* *
* @since 4.0 * @since 4.0
*/ */
private void initializeFont() { private void initializeFont() {
@ -279,12 +304,12 @@ public class SourceViewerInformationControl implements IInformationControl, IInf
fViewer.setInput(null); fViewer.setInput(null);
return; return;
} }
IDocument doc= new Document(content); IDocument doc= new Document(content);
CUIPlugin.getDefault().getTextTools().setupCDocument(doc); CUIPlugin.getDefault().getTextTools().setupCDocument(doc);
fViewer.setInput(doc); fViewer.setInput(doc);
} }
/* /*
* @see IInformationControl#setVisible(boolean) * @see IInformationControl#setVisible(boolean)
*/ */
@ -299,27 +324,29 @@ public class SourceViewerInformationControl implements IInformationControl, IInf
public void widgetDisposed(DisposeEvent event) { public void widgetDisposed(DisposeEvent event) {
if (fStatusTextFont != null && !fStatusTextFont.isDisposed()) if (fStatusTextFont != null && !fStatusTextFont.isDisposed())
fStatusTextFont.dispose(); fStatusTextFont.dispose();
fStatusTextFont= null; fStatusTextFont= null;
fShell= null; fShell= null;
fText= null; fText= null;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public final void dispose() { public final void dispose() {
if (!fIsSystemBackgroundColor)
fBackgroundColor.dispose();
if (fShell != null && !fShell.isDisposed()) if (fShell != null && !fShell.isDisposed())
fShell.dispose(); fShell.dispose();
else else
widgetDisposed(null); widgetDisposed(null);
} }
/* /*
* @see IInformationControl#setSize(int, int) * @see IInformationControl#setSize(int, int)
*/ */
public void setSize(int width, int height) { public void setSize(int width, int height) {
if (fStatusField != null) { if (fStatusField != null) {
GridData gd= (GridData)fViewer.getTextWidget().getLayoutData(); GridData gd= (GridData)fViewer.getTextWidget().getLayoutData();
Point statusSize= fStatusField.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); Point statusSize= fStatusField.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
@ -327,22 +354,18 @@ public class SourceViewerInformationControl implements IInformationControl, IInf
gd.heightHint= height - statusSize.y - separatorSize.y; gd.heightHint= height - statusSize.y - separatorSize.y;
} }
fShell.setSize(width, height); fShell.setSize(width, height);
if (fStatusField != null) if (fStatusField != null)
fShell.pack(true); fShell.pack(true);
} }
/* /*
* @see IInformationControl#setLocation(Point) * @see IInformationControl#setLocation(Point)
*/ */
public void setLocation(Point location) { public void setLocation(Point location) {
Rectangle trim= fShell.computeTrim(0, 0, 0, 0); fShell.setLocation(location);
Point textLocation= fText.getLocation();
location.x += trim.x - textLocation.x;
location.y += trim.y - textLocation.y;
fShell.setLocation(location);
} }
/* /*
* @see IInformationControl#setSizeConstraints(int, int) * @see IInformationControl#setSizeConstraints(int, int)
*/ */
@ -350,7 +373,7 @@ public class SourceViewerInformationControl implements IInformationControl, IInf
fMaxWidth= maxWidth; fMaxWidth= maxWidth;
fMaxHeight= maxHeight; fMaxHeight= maxHeight;
} }
/* /*
* @see IInformationControl#computeSizeHint() * @see IInformationControl#computeSizeHint()
*/ */
@ -370,42 +393,42 @@ public class SourceViewerInformationControl implements IInformationControl, IInf
return size; return size;
} }
/* /*
* @see IInformationControl#addDisposeListener(DisposeListener) * @see IInformationControl#addDisposeListener(DisposeListener)
*/ */
public void addDisposeListener(DisposeListener listener) { public void addDisposeListener(DisposeListener listener) {
fShell.addDisposeListener(listener); fShell.addDisposeListener(listener);
} }
/* /*
* @see IInformationControl#removeDisposeListener(DisposeListener) * @see IInformationControl#removeDisposeListener(DisposeListener)
*/ */
public void removeDisposeListener(DisposeListener listener) { public void removeDisposeListener(DisposeListener listener) {
fShell.removeDisposeListener(listener); fShell.removeDisposeListener(listener);
} }
/* /*
* @see IInformationControl#setForegroundColor(Color) * @see IInformationControl#setForegroundColor(Color)
*/ */
public void setForegroundColor(Color foreground) { public void setForegroundColor(Color foreground) {
fText.setForeground(foreground); fText.setForeground(foreground);
} }
/* /*
* @see IInformationControl#setBackgroundColor(Color) * @see IInformationControl#setBackgroundColor(Color)
*/ */
public void setBackgroundColor(Color background) { public void setBackgroundColor(Color background) {
fText.setBackground(background); fText.setBackground(background);
} }
/* /*
* @see IInformationControl#isFocusControl() * @see IInformationControl#isFocusControl()
*/ */
public boolean isFocusControl() { public boolean isFocusControl() {
return fText.isFocusControl(); return fText.isFocusControl();
} }
/* /*
* @see IInformationControl#setFocus() * @see IInformationControl#setFocus()
*/ */
@ -413,28 +436,28 @@ public class SourceViewerInformationControl implements IInformationControl, IInf
fShell.forceFocus(); fShell.forceFocus();
fText.setFocus(); fText.setFocus();
} }
/* /*
* @see IInformationControl#addFocusListener(FocusListener) * @see IInformationControl#addFocusListener(FocusListener)
*/ */
public void addFocusListener(FocusListener listener) { public void addFocusListener(FocusListener listener) {
fText.addFocusListener(listener); fText.addFocusListener(listener);
} }
/* /*
* @see IInformationControl#removeFocusListener(FocusListener) * @see IInformationControl#removeFocusListener(FocusListener)
*/ */
public void removeFocusListener(FocusListener listener) { public void removeFocusListener(FocusListener listener) {
fText.removeFocusListener(listener); fText.removeFocusListener(listener);
} }
/* /*
* @see IInformationControlExtension#hasContents() * @see IInformationControlExtension#hasContents()
*/ */
public boolean hasContents() { public boolean hasContents() {
return fText.getCharCount() > 0; return fText.getCharCount() > 0;
} }
protected ISourceViewer getViewer() { protected ISourceViewer getViewer() {
return fViewer; return fViewer;
} }

View file

@ -17,6 +17,8 @@ import org.eclipse.swt.graphics.RGB;
import org.eclipse.cdt.internal.ui.text.CTextTools; import org.eclipse.cdt.internal.ui.text.CTextTools;
import org.eclipse.cdt.internal.ui.text.IColorManager; import org.eclipse.cdt.internal.ui.text.IColorManager;
import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.ui.PreferenceConstants;
import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter; import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IDocument;
@ -35,13 +37,13 @@ public class ContentAssistPreference {
/** Preference key for content assist timeout delay (unused) */ /** Preference key for content assist timeout delay (unused) */
public final static String TIMEOUT_DELAY= "content_assist_timeout_delay"; //$NON-NLS-1$ public final static String TIMEOUT_DELAY= "content_assist_timeout_delay"; //$NON-NLS-1$
/** Preference key for content assist proposal color */ /** Preference key for content assist proposal color */
public final static String PROPOSALS_FOREGROUND= "content_assist_proposals_foreground"; //$NON-NLS-1$ public final static String PROPOSALS_FOREGROUND= PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND;
/** Preference key for content assist proposal color */ /** Preference key for content assist proposal color */
public final static String PROPOSALS_BACKGROUND= "content_assist_proposals_background"; //$NON-NLS-1$ public final static String PROPOSALS_BACKGROUND= PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND;
/** Preference key for content assist parameters color */ /** Preference key for content assist parameters color */
public final static String PARAMETERS_FOREGROUND= "content_assist_parameters_foreground"; //$NON-NLS-1$ public final static String PARAMETERS_FOREGROUND= PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND;
/** Preference key for content assist parameters color */ /** Preference key for content assist parameters color */
public final static String PARAMETERS_BACKGROUND= "content_assist_parameters_background"; //$NON-NLS-1$ public final static String PARAMETERS_BACKGROUND= PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND;
/** Preference key for content assist auto insert */ /** Preference key for content assist auto insert */
public final static String AUTOINSERT= "content_assist_autoinsert"; //$NON-NLS-1$ public final static String AUTOINSERT= "content_assist_autoinsert"; //$NON-NLS-1$
/** Preference key for content assist to insert the common prefix */ /** Preference key for content assist to insert the common prefix */
@ -104,7 +106,7 @@ public class ContentAssistPreference {
// boolean enabled; // boolean enabled;
// enabled= store.getBoolean(SHOW_DOCUMENTED_PROPOSALS); // enabled= store.getBoolean(SHOW_DOCUMENTED_PROPOSALS);
// ccp.restrictProposalsToVisibility(enabled); // ccp.restrictProposalsToVisibility(enabled);
// //
// enabled= store.getBoolean(CASE_SENSITIVITY); // enabled= store.getBoolean(CASE_SENSITIVITY);
// ccp.restrictProposalsToMatchingCases(enabled); // ccp.restrictProposalsToMatchingCases(enabled);
@ -112,23 +114,23 @@ public class ContentAssistPreference {
// ccp.orderProposalsAlphabetically(enabled); // ccp.orderProposalsAlphabetically(enabled);
// enabled= store.getBoolean(ADD_INCLUDE); // enabled= store.getBoolean(ADD_INCLUDE);
// ccp.allowAddingIncludes(enabled); // ccp.allowAddingIncludes(enabled);
} }
/** /**
* Configure the given content assistant from the given store. * Configure the given content assistant from the given store.
*/ */
public static void configure(ContentAssistant assistant, IPreferenceStore store) { public static void configure(ContentAssistant assistant, IPreferenceStore store) {
CTextTools textTools= CUIPlugin.getDefault().getTextTools(); CTextTools textTools= CUIPlugin.getDefault().getTextTools();
IColorManager manager= textTools.getColorManager(); IColorManager manager= textTools.getColorManager();
boolean enabledDot= store.getBoolean(AUTOACTIVATION_TRIGGERS_DOT); boolean enabledDot= store.getBoolean(AUTOACTIVATION_TRIGGERS_DOT);
boolean enabledArrow= store.getBoolean(AUTOACTIVATION_TRIGGERS_ARROW); boolean enabledArrow= store.getBoolean(AUTOACTIVATION_TRIGGERS_ARROW);
boolean enabledDoubleColon= store.getBoolean(AUTOACTIVATION_TRIGGERS_DOUBLECOLON); boolean enabledDoubleColon= store.getBoolean(AUTOACTIVATION_TRIGGERS_DOUBLECOLON);
boolean enabled = ((enabledDot) || ( enabledArrow ) || (enabledDoubleColon )); boolean enabled = ((enabledDot) || ( enabledArrow ) || (enabledDoubleColon ));
assistant.enableAutoActivation(enabled); assistant.enableAutoActivation(enabled);
int delay= store.getInt(AUTOACTIVATION_DELAY); int delay= store.getInt(AUTOACTIVATION_DELAY);
assistant.setAutoActivationDelay(delay); assistant.setAutoActivationDelay(delay);
@ -162,7 +164,7 @@ public class ContentAssistPreference {
if (ccp == null) if (ccp == null)
return; return;
if ( (AUTOACTIVATION_TRIGGERS_DOT.equals(key)) if ( (AUTOACTIVATION_TRIGGERS_DOT.equals(key))
|| (AUTOACTIVATION_TRIGGERS_ARROW.equals(key)) || (AUTOACTIVATION_TRIGGERS_ARROW.equals(key))
|| (AUTOACTIVATION_TRIGGERS_DOUBLECOLON.equals(key)) ){ || (AUTOACTIVATION_TRIGGERS_DOUBLECOLON.equals(key)) ){
boolean useDotAsTrigger = store.getBoolean(AUTOACTIVATION_TRIGGERS_DOT); boolean useDotAsTrigger = store.getBoolean(AUTOACTIVATION_TRIGGERS_DOT);
@ -205,14 +207,14 @@ public class ContentAssistPreference {
String p= event.getProperty(); String p= event.getProperty();
if ((AUTOACTIVATION_TRIGGERS_DOT.equals(p)) if ((AUTOACTIVATION_TRIGGERS_DOT.equals(p))
|| (AUTOACTIVATION_TRIGGERS_ARROW.equals(p)) || (AUTOACTIVATION_TRIGGERS_ARROW.equals(p))
|| (AUTOACTIVATION_TRIGGERS_DOUBLECOLON.equals(p))){ || (AUTOACTIVATION_TRIGGERS_DOUBLECOLON.equals(p))){
boolean enabledDot= store.getBoolean(AUTOACTIVATION_TRIGGERS_DOT); boolean enabledDot= store.getBoolean(AUTOACTIVATION_TRIGGERS_DOT);
boolean enabledArrow= store.getBoolean(AUTOACTIVATION_TRIGGERS_ARROW); boolean enabledArrow= store.getBoolean(AUTOACTIVATION_TRIGGERS_ARROW);
boolean enabledDoubleColon= store.getBoolean(AUTOACTIVATION_TRIGGERS_DOUBLECOLON); boolean enabledDoubleColon= store.getBoolean(AUTOACTIVATION_TRIGGERS_DOUBLECOLON);
boolean enabled = ((enabledDot) || ( enabledArrow ) || (enabledDoubleColon )); boolean enabled = ((enabledDot) || ( enabledArrow ) || (enabledDoubleColon ));
assistant.enableAutoActivation(enabled); assistant.enableAutoActivation(enabled);
} else if (AUTOACTIVATION_DELAY.equals(p)) { } else if (AUTOACTIVATION_DELAY.equals(p)) {
int delay= store.getInt(AUTOACTIVATION_DELAY); int delay= store.getInt(AUTOACTIVATION_DELAY);
assistant.setAutoActivationDelay(delay); assistant.setAutoActivationDelay(delay);
@ -236,7 +238,7 @@ public class ContentAssistPreference {
} else if (PREFIX_COMPLETION.equals(p)) { } else if (PREFIX_COMPLETION.equals(p)) {
boolean enabled= store.getBoolean(PREFIX_COMPLETION); boolean enabled= store.getBoolean(PREFIX_COMPLETION);
assistant.enablePrefixCompletion(enabled); assistant.enablePrefixCompletion(enabled);
} }
changeCProcessor(assistant, store, p); changeCProcessor(assistant, store, p);
} }