diff --git a/core/org.eclipse.cdt.ui/ChangeLog b/core/org.eclipse.cdt.ui/ChangeLog index 6db09683142..f8704be9320 100644 --- a/core/org.eclipse.cdt.ui/ChangeLog +++ b/core/org.eclipse.cdt.ui/ChangeLog @@ -3,6 +3,13 @@ - modify UI to allow selecting Definitions for more items * src/org/eclipse/cdt/internal/ui/search/CSearchPage.java +2003-09-26 Hoda Amer + Solution to : + bug#43149: Code Assist Preferences: Background Color not working.... + bug#43153: Code Assist Preferences: Disabling "Insert single proposa... + bug#43154: Code Assist Preferences: Enable Auto activation not working + bug#42224: Code Assist preferences Do not work properly + 2003-09-25 Hoda Amer Solution to bug#43646: Code Assist won't work if missing end bracket diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java index f69f6e750c2..56da68a301f 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java @@ -23,6 +23,7 @@ import org.eclipse.cdt.internal.ui.editor.asm.AsmTextTools; import org.eclipse.cdt.internal.ui.text.CPairMatcher; import org.eclipse.cdt.internal.ui.text.CSourceViewerConfiguration; import org.eclipse.cdt.internal.ui.text.CTextTools; +import org.eclipse.cdt.internal.ui.text.ContentAssistPreference; import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.cdt.ui.IWorkingCopyManager; import org.eclipse.core.resources.IFile; @@ -43,6 +44,8 @@ import org.eclipse.jface.text.ITextOperationTarget; import org.eclipse.jface.text.ITextSelection; import org.eclipse.jface.text.ITextViewerExtension; import org.eclipse.jface.text.Position; +import org.eclipse.jface.text.contentassist.ContentAssistant; +import org.eclipse.jface.text.contentassist.IContentAssistant; import org.eclipse.jface.text.source.Annotation; import org.eclipse.jface.text.source.IAnnotationAccess; import org.eclipse.jface.text.source.IAnnotationModel; @@ -257,6 +260,11 @@ public class CEditor extends TextEditor implements ISelectionChangedListener { stopTabConversion(); return; } + + IContentAssistant c= asv.getContentAssistant(); + if (c instanceof ContentAssistant) + ContentAssistPreference.changeConfiguration((ContentAssistant) c, getPreferenceStore(), event); + } } finally { super.handlePreferenceStoreChanged(event); @@ -709,6 +717,9 @@ public class CEditor extends TextEditor implements ISelectionChangedListener { super(parent, ruler, fOverviewRuler, isOverviewRulerShowing, styles); fDisplayLanguage = language; } + public IContentAssistant getContentAssistant() { + return fContentAssistant; + } /* * @see ITextOperationTarget#doOperation(int) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorPreferencePage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorPreferencePage.java index c71d47bcbff..b60ce22c214 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorPreferencePage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CEditorPreferencePage.java @@ -232,6 +232,12 @@ public class CEditorPreferencePage extends PreferencePage implements IWorkbenchP overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ContentAssistPreference.AUTOINSERT)); overlayKeys.add( new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, ContentAssistPreference.PROPOSALS_BACKGROUND)); + 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_FOREGROUND)); overlayKeys.add( new OverlayPreferenceStore.OverlayKey( OverlayPreferenceStore.STRING, @@ -331,9 +337,9 @@ public class CEditorPreferencePage extends PreferencePage implements IWorkbenchP store.setDefault(ContentAssistPreference.AUTOINSERT, true); 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)); + 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)); //store.setDefault(ContentAssistPreference.AUTOACTIVATION_TRIGGERS_C, ".,"); //store.setDefault(ContentAssistPreference.AUTOACTIVATION_TRIGGERS_JAVADOC, "@"); //store.setDefault(ContentAssistPreference.SHOW_VISIBLE_PROPOSALS, true); @@ -912,14 +918,14 @@ public class CEditorPreferencePage extends PreferencePage implements IWorkbenchP label = "&Background for completion proposals:"; addColorButton(contentAssistComposite, label, ContentAssistPreference.PROPOSALS_BACKGROUND, 0); - //label= "&Foreground for completion proposals:"; - //addColorButton(contentAssistComposite, label, ContentAssistPreference.PROPOSALS_FOREGROUND, 0); + label= "&Foreground for completion proposals:"; + addColorButton(contentAssistComposite, label, ContentAssistPreference.PROPOSALS_FOREGROUND, 0); - //label= "Bac&kground for method parameters:"; - //addColorButton(contentAssistComposite, label, ContentAssistPreference.PARAMETERS_BACKGROUND, 0); - - //label= "Fo®round for method parameters:"; - //addColorButton(contentAssistComposite, label, ContentAssistPreference.PARAMETERS_FOREGROUND, 0); +// label= "Bac&kground for method parameters:"; +// addColorButton(contentAssistComposite, label, ContentAssistPreference.PARAMETERS_BACKGROUND, 0); +// +// label= "Fo®round for method parameters:"; +// addColorButton(contentAssistComposite, label, ContentAssistPreference.PARAMETERS_FOREGROUND, 0); return contentAssistComposite; } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/EditTemplateDialog.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/EditTemplateDialog.java index dffda338db2..d15643ea5f3 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/EditTemplateDialog.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/EditTemplateDialog.java @@ -118,13 +118,13 @@ public class EditTemplateDialog extends StatusDialog { Color background= createColor(store, ContentAssistPreference.PROPOSALS_BACKGROUND, display); assistant.setContextInformationPopupBackground(background); - //assistant.setContextSelectorBackground(background); - //assistant.setProposalSelectorBackground(background); + assistant.setContextSelectorBackground(background); + assistant.setProposalSelectorBackground(background); - //Color foreground= createColor(store, ContentAssistPreference.PROPOSALS_FOREGROUND, display); - //assistant.setContextInformationPopupForeground(foreground); - //assistant.setContextSelectorForeground(foreground); - //assistant.setProposalSelectorForeground(foreground); + Color foreground= createColor(store, ContentAssistPreference.PROPOSALS_FOREGROUND, display); + assistant.setContextInformationPopupForeground(foreground); + assistant.setContextSelectorForeground(foreground); + assistant.setProposalSelectorForeground(foreground); return assistant; } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CCompletionProcessor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CCompletionProcessor.java index ecef175b781..9f10d2d99be 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CCompletionProcessor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CCompletionProcessor.java @@ -588,7 +588,8 @@ public class CCompletionProcessor implements IContentAssistProcessor { // The info string could be populated with documentation info. // For now, it has the name and the parent's name if available. - proposal.setAdditionalProposalInfo(infoString.toString()); + if(!displayString.equals(infoString.toString())) + proposal.setAdditionalProposalInfo(infoString.toString()); } } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CSourceViewerConfiguration.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CSourceViewerConfiguration.java index cccdceea30a..268ee31a347 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CSourceViewerConfiguration.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CSourceViewerConfiguration.java @@ -177,13 +177,9 @@ public class CSourceViewerConfiguration extends SourceViewerConfiguration { assistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE); //Will this work as a replacement for the configuration lines below? - //ContentAssistPreference.configure(assistant, getPreferenceStore()); - - assistant.enableAutoInsert(CUIPlugin.getDefault().getPreferenceStore().getBoolean(ContentAssistPreference.AUTOINSERT)); - assistant.enableAutoActivation(true); - assistant.setAutoActivationDelay(500); - assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY); + ContentAssistPreference.configure(assistant, getPreferenceStore()); + assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY); assistant.setContextInformationPopupOrientation(ContentAssistant.CONTEXT_INFO_ABOVE); assistant.setInformationControlCreator(getInformationControlCreator(sourceViewer)); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/ContentAssistPreference.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/ContentAssistPreference.java index 5d757162e2f..0efe572ef48 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/ContentAssistPreference.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/ContentAssistPreference.java @@ -90,34 +90,33 @@ public class ContentAssistPreference { /** * 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(); IColorManager manager= textTools.getColorManager(); - boolean enabled= store.getBoolean(AUTOACTIVATION); assistant.enableAutoActivation(enabled); int delay= store.getInt(AUTOACTIVATION_DELAY); assistant.setAutoActivationDelay(delay); - //Color c= getColor(store, PROPOSALS_FOREGROUND, manager); - //assistant.setProposalSelectorForeground(c); + Color c1= getColor(store, PROPOSALS_FOREGROUND, manager); + assistant.setProposalSelectorForeground(c1); - Color c= getColor(store, PROPOSALS_BACKGROUND, manager); - assistant.setContextInformationPopupBackground(c); + Color c2= getColor(store, PROPOSALS_BACKGROUND, manager); + assistant.setProposalSelectorBackground(c2); - c= getColor(store, PARAMETERS_FOREGROUND, manager); - //assistant.setContextInformationPopupForeground(c); - //assistant.setContextSelectorForeground(c); + Color c3= getColor(store, PARAMETERS_FOREGROUND, manager); + assistant.setContextInformationPopupForeground(c3); + assistant.setContextSelectorForeground(c3); - c= getColor(store, PARAMETERS_BACKGROUND, manager); - assistant.setContextInformationPopupBackground(c); - //assistant.setContextSelectorBackground(c); + Color c4= getColor(store, PARAMETERS_BACKGROUND, manager); + assistant.setContextInformationPopupBackground(c4); + assistant.setContextSelectorBackground(c4); enabled= store.getBoolean(AUTOINSERT); - //assistant.enableAutoInsert(enabled); + assistant.enableAutoInsert(enabled); configureCProcessor(assistant, store); } @@ -162,22 +161,22 @@ public class ContentAssistPreference { int delay= store.getInt(AUTOACTIVATION_DELAY); assistant.setAutoActivationDelay(delay); } else if (PROPOSALS_FOREGROUND.equals(p)) { - //Color c= getColor(store, PROPOSALS_FOREGROUND); - //assistant.setProposalSelectorForeground(c); + Color c= getColor(store, PROPOSALS_FOREGROUND); + assistant.setProposalSelectorForeground(c); } else if (PROPOSALS_BACKGROUND.equals(p)) { - //Color c= getColor(store, PROPOSALS_BACKGROUND); - //assistant.setProposalSelectorBackground(c); + Color c= getColor(store, PROPOSALS_BACKGROUND); + assistant.setProposalSelectorBackground(c); } else if (PARAMETERS_FOREGROUND.equals(p)) { - //Color c= getColor(store, PARAMETERS_FOREGROUND); - //assistant.setContextInformationPopupForeground(c); - //assistant.setContextSelectorForeground(c); + Color c= getColor(store, PARAMETERS_FOREGROUND); + assistant.setContextInformationPopupForeground(c); + assistant.setContextSelectorForeground(c); } else if (PARAMETERS_BACKGROUND.equals(p)) { Color c= getColor(store, PARAMETERS_BACKGROUND); assistant.setContextInformationPopupBackground(c); - //assistant.setContextSelectorBackground(c); + assistant.setContextSelectorBackground(c); } else if (AUTOINSERT.equals(p)) { - //boolean enabled= store.getBoolean(AUTOINSERT); - //assistant.enableAutoInsert(enabled); + boolean enabled= store.getBoolean(AUTOINSERT); + assistant.enableAutoInsert(enabled); } changeCProcessor(assistant, store, p);