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 - modify UI to allow selecting Definitions for more items
* src/org/eclipse/cdt/internal/ui/search/CSearchPage.java * 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 2003-09-25 Hoda Amer
Solution to bug#43646: Code Assist won't work if missing end bracket 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.CPairMatcher;
import org.eclipse.cdt.internal.ui.text.CSourceViewerConfiguration; import org.eclipse.cdt.internal.ui.text.CSourceViewerConfiguration;
import org.eclipse.cdt.internal.ui.text.CTextTools; 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.CUIPlugin;
import org.eclipse.cdt.ui.IWorkingCopyManager; import org.eclipse.cdt.ui.IWorkingCopyManager;
import org.eclipse.core.resources.IFile; 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.ITextSelection;
import org.eclipse.jface.text.ITextViewerExtension; import org.eclipse.jface.text.ITextViewerExtension;
import org.eclipse.jface.text.Position; 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.Annotation;
import org.eclipse.jface.text.source.IAnnotationAccess; import org.eclipse.jface.text.source.IAnnotationAccess;
import org.eclipse.jface.text.source.IAnnotationModel; import org.eclipse.jface.text.source.IAnnotationModel;
@ -257,6 +260,11 @@ public class CEditor extends TextEditor implements ISelectionChangedListener {
stopTabConversion(); stopTabConversion();
return; return;
} }
IContentAssistant c= asv.getContentAssistant();
if (c instanceof ContentAssistant)
ContentAssistPreference.changeConfiguration((ContentAssistant) c, getPreferenceStore(), event);
} }
} finally { } finally {
super.handlePreferenceStoreChanged(event); super.handlePreferenceStoreChanged(event);
@ -709,6 +717,9 @@ public class CEditor extends TextEditor implements ISelectionChangedListener {
super(parent, ruler, fOverviewRuler, isOverviewRulerShowing, styles); super(parent, ruler, fOverviewRuler, isOverviewRulerShowing, styles);
fDisplayLanguage = language; fDisplayLanguage = language;
} }
public IContentAssistant getContentAssistant() {
return fContentAssistant;
}
/* /*
* @see ITextOperationTarget#doOperation(int) * @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.BOOLEAN, ContentAssistPreference.AUTOINSERT));
overlayKeys.add( overlayKeys.add(
new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, ContentAssistPreference.PROPOSALS_BACKGROUND)); 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( overlayKeys.add(
new OverlayPreferenceStore.OverlayKey( new OverlayPreferenceStore.OverlayKey(
OverlayPreferenceStore.STRING, OverlayPreferenceStore.STRING,
@ -331,9 +337,9 @@ public class CEditorPreferencePage extends PreferencePage implements IWorkbenchP
store.setDefault(ContentAssistPreference.AUTOINSERT, true); store.setDefault(ContentAssistPreference.AUTOINSERT, true);
PreferenceConverter.setDefault(store, ContentAssistPreference.PROPOSALS_BACKGROUND, new RGB(254, 241, 233)); 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.PROPOSALS_FOREGROUND, new RGB(0, 0, 0));
//PreferenceConverter.setDefault(store, ContentAssistPreference.PARAMETERS_BACKGROUND, new RGB(254, 241, 233)); 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.PARAMETERS_FOREGROUND, new RGB(0, 0, 0));
//store.setDefault(ContentAssistPreference.AUTOACTIVATION_TRIGGERS_C, ".,"); //store.setDefault(ContentAssistPreference.AUTOACTIVATION_TRIGGERS_C, ".,");
//store.setDefault(ContentAssistPreference.AUTOACTIVATION_TRIGGERS_JAVADOC, "@"); //store.setDefault(ContentAssistPreference.AUTOACTIVATION_TRIGGERS_JAVADOC, "@");
//store.setDefault(ContentAssistPreference.SHOW_VISIBLE_PROPOSALS, true); //store.setDefault(ContentAssistPreference.SHOW_VISIBLE_PROPOSALS, true);
@ -912,14 +918,14 @@ public class CEditorPreferencePage extends PreferencePage implements IWorkbenchP
label = "&Background for completion proposals:"; label = "&Background for completion proposals:";
addColorButton(contentAssistComposite, label, ContentAssistPreference.PROPOSALS_BACKGROUND, 0); addColorButton(contentAssistComposite, label, ContentAssistPreference.PROPOSALS_BACKGROUND, 0);
//label= "&Foreground for completion proposals:"; label= "&Foreground for completion proposals:";
//addColorButton(contentAssistComposite, label, ContentAssistPreference.PROPOSALS_FOREGROUND, 0); addColorButton(contentAssistComposite, label, ContentAssistPreference.PROPOSALS_FOREGROUND, 0);
//label= "Bac&kground for method parameters:"; // label= "Bac&kground for method parameters:";
//addColorButton(contentAssistComposite, label, ContentAssistPreference.PARAMETERS_BACKGROUND, 0); // addColorButton(contentAssistComposite, label, ContentAssistPreference.PARAMETERS_BACKGROUND, 0);
//
//label= "Fo&reground for method parameters:"; // label= "Fo&reground for method parameters:";
//addColorButton(contentAssistComposite, label, ContentAssistPreference.PARAMETERS_FOREGROUND, 0); // addColorButton(contentAssistComposite, label, ContentAssistPreference.PARAMETERS_FOREGROUND, 0);
return contentAssistComposite; return contentAssistComposite;
} }

View file

@ -118,13 +118,13 @@ public class EditTemplateDialog extends StatusDialog {
Color background= createColor(store, ContentAssistPreference.PROPOSALS_BACKGROUND, display); Color background= createColor(store, ContentAssistPreference.PROPOSALS_BACKGROUND, display);
assistant.setContextInformationPopupBackground(background); assistant.setContextInformationPopupBackground(background);
//assistant.setContextSelectorBackground(background); assistant.setContextSelectorBackground(background);
//assistant.setProposalSelectorBackground(background); assistant.setProposalSelectorBackground(background);
//Color foreground= createColor(store, ContentAssistPreference.PROPOSALS_FOREGROUND, display); Color foreground= createColor(store, ContentAssistPreference.PROPOSALS_FOREGROUND, display);
//assistant.setContextInformationPopupForeground(foreground); assistant.setContextInformationPopupForeground(foreground);
//assistant.setContextSelectorForeground(foreground); assistant.setContextSelectorForeground(foreground);
//assistant.setProposalSelectorForeground(foreground); assistant.setProposalSelectorForeground(foreground);
return assistant; return assistant;
} }

View file

@ -588,6 +588,7 @@ public class CCompletionProcessor implements IContentAssistProcessor {
// The info string could be populated with documentation info. // The info string could be populated with documentation info.
// For now, it has the name and the parent's name if available. // For now, it has the name and the parent's name if available.
if(!displayString.equals(infoString.toString()))
proposal.setAdditionalProposalInfo(infoString.toString()); proposal.setAdditionalProposalInfo(infoString.toString());
} }
} }

View file

@ -177,13 +177,9 @@ public class CSourceViewerConfiguration extends SourceViewerConfiguration {
assistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE); assistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE);
//Will this work as a replacement for the configuration lines below? //Will this work as a replacement for the configuration lines below?
//ContentAssistPreference.configure(assistant, getPreferenceStore()); ContentAssistPreference.configure(assistant, getPreferenceStore());
assistant.enableAutoInsert(CUIPlugin.getDefault().getPreferenceStore().getBoolean(ContentAssistPreference.AUTOINSERT));
assistant.enableAutoActivation(true);
assistant.setAutoActivationDelay(500);
assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY); assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
assistant.setContextInformationPopupOrientation(ContentAssistant.CONTEXT_INFO_ABOVE); assistant.setContextInformationPopupOrientation(ContentAssistant.CONTEXT_INFO_ABOVE);
assistant.setInformationControlCreator(getInformationControlCreator(sourceViewer)); assistant.setInformationControlCreator(getInformationControlCreator(sourceViewer));

View file

@ -95,29 +95,28 @@ public class ContentAssistPreference {
CTextTools textTools= CUIPlugin.getDefault().getTextTools(); CTextTools textTools= CUIPlugin.getDefault().getTextTools();
IColorManager manager= textTools.getColorManager(); IColorManager manager= textTools.getColorManager();
boolean enabled= store.getBoolean(AUTOACTIVATION); boolean enabled= store.getBoolean(AUTOACTIVATION);
assistant.enableAutoActivation(enabled); assistant.enableAutoActivation(enabled);
int delay= store.getInt(AUTOACTIVATION_DELAY); int delay= store.getInt(AUTOACTIVATION_DELAY);
assistant.setAutoActivationDelay(delay); assistant.setAutoActivationDelay(delay);
//Color c= getColor(store, PROPOSALS_FOREGROUND, manager); Color c1= getColor(store, PROPOSALS_FOREGROUND, manager);
//assistant.setProposalSelectorForeground(c); assistant.setProposalSelectorForeground(c1);
Color c= getColor(store, PROPOSALS_BACKGROUND, manager); Color c2= getColor(store, PROPOSALS_BACKGROUND, manager);
assistant.setContextInformationPopupBackground(c); assistant.setProposalSelectorBackground(c2);
c= getColor(store, PARAMETERS_FOREGROUND, manager); Color c3= getColor(store, PARAMETERS_FOREGROUND, manager);
//assistant.setContextInformationPopupForeground(c); assistant.setContextInformationPopupForeground(c3);
//assistant.setContextSelectorForeground(c); assistant.setContextSelectorForeground(c3);
c= getColor(store, PARAMETERS_BACKGROUND, manager); Color c4= getColor(store, PARAMETERS_BACKGROUND, manager);
assistant.setContextInformationPopupBackground(c); assistant.setContextInformationPopupBackground(c4);
//assistant.setContextSelectorBackground(c); assistant.setContextSelectorBackground(c4);
enabled= store.getBoolean(AUTOINSERT); enabled= store.getBoolean(AUTOINSERT);
//assistant.enableAutoInsert(enabled); assistant.enableAutoInsert(enabled);
configureCProcessor(assistant, store); configureCProcessor(assistant, store);
} }
@ -162,22 +161,22 @@ public class ContentAssistPreference {
int delay= store.getInt(AUTOACTIVATION_DELAY); int delay= store.getInt(AUTOACTIVATION_DELAY);
assistant.setAutoActivationDelay(delay); assistant.setAutoActivationDelay(delay);
} else if (PROPOSALS_FOREGROUND.equals(p)) { } else if (PROPOSALS_FOREGROUND.equals(p)) {
//Color c= getColor(store, PROPOSALS_FOREGROUND); Color c= getColor(store, PROPOSALS_FOREGROUND);
//assistant.setProposalSelectorForeground(c); assistant.setProposalSelectorForeground(c);
} else if (PROPOSALS_BACKGROUND.equals(p)) { } else if (PROPOSALS_BACKGROUND.equals(p)) {
//Color c= getColor(store, PROPOSALS_BACKGROUND); Color c= getColor(store, PROPOSALS_BACKGROUND);
//assistant.setProposalSelectorBackground(c); assistant.setProposalSelectorBackground(c);
} else if (PARAMETERS_FOREGROUND.equals(p)) { } else if (PARAMETERS_FOREGROUND.equals(p)) {
//Color c= getColor(store, PARAMETERS_FOREGROUND); Color c= getColor(store, PARAMETERS_FOREGROUND);
//assistant.setContextInformationPopupForeground(c); assistant.setContextInformationPopupForeground(c);
//assistant.setContextSelectorForeground(c); assistant.setContextSelectorForeground(c);
} else if (PARAMETERS_BACKGROUND.equals(p)) { } else if (PARAMETERS_BACKGROUND.equals(p)) {
Color c= getColor(store, PARAMETERS_BACKGROUND); Color c= getColor(store, PARAMETERS_BACKGROUND);
assistant.setContextInformationPopupBackground(c); assistant.setContextInformationPopupBackground(c);
//assistant.setContextSelectorBackground(c); assistant.setContextSelectorBackground(c);
} else if (AUTOINSERT.equals(p)) { } else if (AUTOINSERT.equals(p)) {
//boolean enabled= store.getBoolean(AUTOINSERT); boolean enabled= store.getBoolean(AUTOINSERT);
//assistant.enableAutoInsert(enabled); assistant.enableAutoInsert(enabled);
} }
changeCProcessor(assistant, store, p); changeCProcessor(assistant, store, p);