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

Patch for Hoda Amer

UI: 
        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
This commit is contained in:
John Camelon 2003-09-26 15:25:45 +00:00
parent 05f6b423c8
commit 9df570138a
7 changed files with 67 additions and 47 deletions

View file

@ -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

View file

@ -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)

View file

@ -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&reground 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&reground for method parameters:";
// addColorButton(contentAssistComposite, label, ContentAssistPreference.PARAMETERS_FOREGROUND, 0);
return contentAssistComposite;
}

View file

@ -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;
}

View file

@ -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());
}
}

View file

@ -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));

View file

@ -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);