[173783] completion proposal selection bareble visible
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextEditor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextEditor.java
index 8f01c2c..0221945 100644
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextEditor.java
+++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextEditor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
+ * Copyright (c) 2001, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -41,6 +41,7 @@
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.DefaultInformationControl;
import org.eclipse.jface.text.DocumentEvent;
@@ -60,6 +61,7 @@
import org.eclipse.jface.text.ITextViewerExtension5;
import org.eclipse.jface.text.TextSelection;
import org.eclipse.jface.text.TextUtilities;
+import org.eclipse.jface.text.contentassist.ContentAssistant;
import org.eclipse.jface.text.contentassist.IContentAssistant;
import org.eclipse.jface.text.information.IInformationProvider;
import org.eclipse.jface.text.information.IInformationProviderExtension2;
@@ -91,8 +93,10 @@
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseMoveListener;
import org.eclipse.swt.events.MouseTrackAdapter;
+import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
@@ -183,6 +187,7 @@
import org.eclipse.wst.sse.ui.internal.selection.SelectionHistory;
import org.eclipse.wst.sse.ui.internal.text.DocumentRegionEdgeMatcher;
import org.eclipse.wst.sse.ui.internal.util.Assert;
+import org.eclipse.wst.sse.ui.internal.util.EditorUtility;
import org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration;
import org.eclipse.wst.sse.ui.views.properties.PropertySheetConfiguration;
@@ -2565,6 +2570,77 @@
}
return;
}
+
+ // update content assist preferences
+ if (EditorPreferenceNames.CODEASSIST_PROPOSALS_BACKGROUND.equals(property)) {
+ ISourceViewer sourceViewer = getSourceViewer();
+ if (sourceViewer != null) {
+ SourceViewerConfiguration configuration = getSourceViewerConfiguration();
+ if (configuration != null) {
+ IContentAssistant contentAssistant = configuration.getContentAssistant(sourceViewer);
+ if (contentAssistant instanceof ContentAssistant) {
+ ContentAssistant assistant = (ContentAssistant)contentAssistant;
+ RGB rgb = PreferenceConverter.getColor(getPreferenceStore(), EditorPreferenceNames.CODEASSIST_PROPOSALS_BACKGROUND);
+ Color color = EditorUtility.getColor(rgb);
+ assistant.setProposalSelectorBackground(color);
+ }
+ }
+ }
+ }
+
+ // update content assist preferences
+ if (EditorPreferenceNames.CODEASSIST_PROPOSALS_FOREGROUND.equals(property)) {
+ ISourceViewer sourceViewer = getSourceViewer();
+ if (sourceViewer != null) {
+ SourceViewerConfiguration configuration = getSourceViewerConfiguration();
+ if (configuration != null) {
+ IContentAssistant contentAssistant = configuration.getContentAssistant(sourceViewer);
+ if (contentAssistant instanceof ContentAssistant) {
+ ContentAssistant assistant = (ContentAssistant)contentAssistant;
+ RGB rgb = PreferenceConverter.getColor(getPreferenceStore(), EditorPreferenceNames.CODEASSIST_PROPOSALS_FOREGROUND);
+ Color color = EditorUtility.getColor(rgb);
+ assistant.setProposalSelectorForeground(color);
+ }
+ }
+ }
+ }
+
+ // update content assist preferences
+ if (EditorPreferenceNames.CODEASSIST_PARAMETERS_BACKGROUND.equals(property)) {
+ ISourceViewer sourceViewer = getSourceViewer();
+ if (sourceViewer != null) {
+ SourceViewerConfiguration configuration = getSourceViewerConfiguration();
+ if (configuration != null) {
+ IContentAssistant contentAssistant = configuration.getContentAssistant(sourceViewer);
+ if (contentAssistant instanceof ContentAssistant) {
+ ContentAssistant assistant = (ContentAssistant)contentAssistant;
+ RGB rgb = PreferenceConverter.getColor(getPreferenceStore(), EditorPreferenceNames.CODEASSIST_PARAMETERS_BACKGROUND);
+ Color color = EditorUtility.getColor(rgb);
+ assistant.setContextInformationPopupBackground(color);
+ assistant.setContextSelectorBackground(color);
+ }
+ }
+ }
+ }
+
+ // update content assist preferences
+ if (EditorPreferenceNames.CODEASSIST_PARAMETERS_FOREGROUND.equals(property)) {
+ ISourceViewer sourceViewer = getSourceViewer();
+ if (sourceViewer != null) {
+ SourceViewerConfiguration configuration = getSourceViewerConfiguration();
+ if (configuration != null) {
+ IContentAssistant contentAssistant = configuration.getContentAssistant(sourceViewer);
+ if (contentAssistant instanceof ContentAssistant) {
+ ContentAssistant assistant = (ContentAssistant)contentAssistant;
+ RGB rgb = PreferenceConverter.getColor(getPreferenceStore(), EditorPreferenceNames.CODEASSIST_PARAMETERS_FOREGROUND);
+ Color color = EditorUtility.getColor(rgb);
+ assistant.setContextInformationPopupForeground(color);
+ assistant.setContextSelectorForeground(color);
+ }
+ }
+ }
+ }
+
super.handlePreferenceStoreChanged(event);
}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextViewerConfiguration.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextViewerConfiguration.java
index 604e9a9..0429f3a 100644
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextViewerConfiguration.java
+++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextViewerConfiguration.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
+ * Copyright (c) 2001, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -13,6 +13,7 @@
package org.eclipse.wst.sse.ui;
import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.jface.text.DefaultInformationControl;
import org.eclipse.jface.text.IInformationControl;
import org.eclipse.jface.text.IInformationControlCreator;
@@ -31,6 +32,8 @@
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.editors.text.EditorsUI;
import org.eclipse.ui.editors.text.TextSourceViewerConfiguration;
@@ -41,6 +44,7 @@
import org.eclipse.wst.sse.ui.internal.contentassist.StructuredContentAssistant;
import org.eclipse.wst.sse.ui.internal.derived.HTMLTextPresenter;
import org.eclipse.wst.sse.ui.internal.hyperlink.HighlighterHyperlinkPresenter;
+import org.eclipse.wst.sse.ui.internal.preferences.EditorPreferenceNames;
import org.eclipse.wst.sse.ui.internal.provisional.preferences.CommonEditorPreferenceNames;
import org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider;
import org.eclipse.wst.sse.ui.internal.reconcile.StructuredRegionProcessor;
@@ -48,6 +52,7 @@
import org.eclipse.wst.sse.ui.internal.taginfo.BestMatchHover;
import org.eclipse.wst.sse.ui.internal.taginfo.ProblemAnnotationHoverProcessor;
import org.eclipse.wst.sse.ui.internal.taginfo.TextHoverManager;
+import org.eclipse.wst.sse.ui.internal.util.EditorUtility;
/**
@@ -121,6 +126,17 @@
}
/**
+ * Get color for the preference key. Assumes fPreferenceStore is not null.
+ *
+ * @param key
+ * @return Color for preference key or null if none found
+ */
+ private Color getColor(String key) {
+ RGB rgb = PreferenceConverter.getColor(fPreferenceStore, key);
+ return EditorUtility.getColor(rgb);
+ }
+
+ /**
* Returns the configured partitioning for the given source viewer. The
* partitioning is used when the querying content types from the source
* viewer's input document.<br />
@@ -194,11 +210,30 @@
// content assistant configurations
fContentAssistant.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
fContentAssistant.enableAutoActivation(true);
- fContentAssistant.setAutoActivationDelay(500);
fContentAssistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
fContentAssistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
fContentAssistant.setInformationControlCreator(getInformationControlCreator(sourceViewer));
+ // set content assist preferences
+ if (fPreferenceStore != null) {
+ int delay = fPreferenceStore.getInt(EditorPreferenceNames.CODEASSIST_AUTOACTIVATION_DELAY);
+ fContentAssistant.setAutoActivationDelay(delay);
+
+ Color color = getColor(EditorPreferenceNames.CODEASSIST_PROPOSALS_BACKGROUND);
+ fContentAssistant.setProposalSelectorBackground(color);
+
+ color = getColor(EditorPreferenceNames.CODEASSIST_PROPOSALS_FOREGROUND);
+ fContentAssistant.setProposalSelectorForeground(color);
+
+ color = getColor(EditorPreferenceNames.CODEASSIST_PARAMETERS_BACKGROUND);
+ fContentAssistant.setContextInformationPopupBackground(color);
+ fContentAssistant.setContextSelectorBackground(color);
+
+ color = getColor(EditorPreferenceNames.CODEASSIST_PARAMETERS_FOREGROUND);
+ fContentAssistant.setContextInformationPopupForeground(color);
+ fContentAssistant.setContextSelectorForeground(color);
+ }
+
// add content assist processors for each partition type
String[] types = getConfiguredContentTypes(sourceViewer);
for (int i = 0; i < types.length; i++) {
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/PreferenceInitializer.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/PreferenceInitializer.java
index 61b56d9..372c808 100644
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/PreferenceInitializer.java
+++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/PreferenceInitializer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * Copyright (c) 2001, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -64,6 +64,13 @@
// set default for show message dialog when unknown content type in editor
store.setDefault(EditorPreferenceNames.SHOW_UNKNOWN_CONTENT_TYPE_MSG, true);
+
+ // set content assist defaults
+ store.setDefault(EditorPreferenceNames.CODEASSIST_AUTOACTIVATION_DELAY, 500);
+ PreferenceConverter.setDefault(store, EditorPreferenceNames.CODEASSIST_PROPOSALS_BACKGROUND, new RGB(255, 255, 255));
+ PreferenceConverter.setDefault(store, EditorPreferenceNames.CODEASSIST_PROPOSALS_FOREGROUND, new RGB(0, 0, 0));
+ PreferenceConverter.setDefault(store, EditorPreferenceNames.CODEASSIST_PARAMETERS_BACKGROUND, new RGB(255, 255, 255));
+ PreferenceConverter.setDefault(store, EditorPreferenceNames.CODEASSIST_PARAMETERS_FOREGROUND, new RGB(0, 0, 0));
}
private void setMatchingBracketsPreferences(IPreferenceStore store) {
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/SSEUIMessages.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/SSEUIMessages.java
index f772686..496ce7b 100644
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/SSEUIMessages.java
+++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/SSEUIMessages.java
@@ -207,6 +207,10 @@
public static String StructuredTextEditorPreferencePage_37;
public static String StructuredTextEditorPreferencePage_38;
public static String StructuredTextEditorPreferencePage_40;
+ public static String StructuredTextEditorPreferencePage_41;
+ public static String StructuredTextEditorPreferencePage_42;
+ public static String StructuredTextEditorPreferencePage_43;
+ public static String StructuredTextEditorPreferencePage_44;
public static String TaskTagPreferenceTab_0;
public static String TaskTagPreferenceTab_1;
public static String TaskTagPreferenceTab_2;
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/SSEUIPluginResources.properties b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/SSEUIPluginResources.properties
index 963725f..b1ea551 100644
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/SSEUIPluginResources.properties
+++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/SSEUIPluginResources.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2001, 2004 IBM Corporation and others.
+# Copyright (c) 2001, 2007 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@@ -181,6 +181,10 @@
StructuredTextEditorPreferencePage_38=is not a valid input.
StructuredTextEditorPreferencePage_39=Inform when unsupported content type is in editor
StructuredTextEditorPreferencePage_40=Also see the <a>''{0}''</a> preferences.
+StructuredTextEditorPreferencePage_41=Completion proposal background
+StructuredTextEditorPreferencePage_42=Completion proposal foreground
+StructuredTextEditorPreferencePage_43=Parameter hints background
+StructuredTextEditorPreferencePage_44=Parameter hints foreground
TaskTagPreferenceTab_0=Low
TaskTagPreferenceTab_1=Normal
TaskTagPreferenceTab_2=High
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/EditorPreferenceNames.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/EditorPreferenceNames.java
index 5130c77..76cccac 100644
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/EditorPreferenceNames.java
+++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/EditorPreferenceNames.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
+ * Copyright (c) 2005, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,6 +11,7 @@
*******************************************************************************/
package org.eclipse.wst.sse.ui.internal.preferences;
+
/**
* Preference keys for SSE UI
*/
@@ -83,4 +84,65 @@
* informing user of unknown content type in editor.
*/
public static final String SHOW_UNKNOWN_CONTENT_TYPE_MSG = "showUnknownContentTypeMsg"; //$NON-NLS-1$
+
+ /**
+ * A name preference that holds the auto activation delay time in
+ * milliseconds.
+ * <p>
+ * Value is of type <code>Integer</code>.
+ * </p>
+ */
+ public final static String CODEASSIST_AUTOACTIVATION_DELAY = "content_assist_autoactivation_delay"; //$NON-NLS-1$
+
+ /**
+ * A named preference that holds the background color used in the code
+ * assist selection dialog.
+ * <p>
+ * Value is of type <code>String</code>. A RGB color value encoded as a
+ * string using class <code>PreferenceConverter</code>
+ * </p>
+ *
+ * @see org.eclipse.jface.resource.StringConverter
+ * @see org.eclipse.jface.preference.PreferenceConverter
+ */
+ public final static String CODEASSIST_PROPOSALS_BACKGROUND = "content_assist_proposals_background"; //$NON-NLS-1$
+
+ /**
+ * A named preference that holds the foreground color used in the code
+ * assist selection dialog.
+ * <p>
+ * Value is of type <code>String</code>. A RGB color value encoded as a
+ * string using class <code>PreferenceConverter</code>
+ * </p>
+ *
+ * @see org.eclipse.jface.resource.StringConverter
+ * @see org.eclipse.jface.preference.PreferenceConverter
+ */
+ public final static String CODEASSIST_PROPOSALS_FOREGROUND = "content_assist_proposals_foreground"; //$NON-NLS-1$
+
+ /**
+ * A named preference that holds the background color used for parameter
+ * hints.
+ * <p>
+ * Value is of type <code>String</code>. A RGB color value encoded as a
+ * string using class <code>PreferenceConverter</code>
+ * </p>
+ *
+ * @see org.eclipse.jface.resource.StringConverter
+ * @see org.eclipse.jface.preference.PreferenceConverter
+ */
+ public final static String CODEASSIST_PARAMETERS_BACKGROUND = "content_assist_parameters_background"; //$NON-NLS-1$
+
+ /**
+ * A named preference that holds the foreground color used in the code
+ * assist selection dialog.
+ * <p>
+ * Value is of type <code>String</code>. A RGB color value encoded as a
+ * string using class <code>PreferenceConverter</code>
+ * </p>
+ *
+ * @see org.eclipse.jface.resource.StringConverter
+ * @see org.eclipse.jface.preference.PreferenceConverter
+ */
+ public final static String CODEASSIST_PARAMETERS_FOREGROUND = "content_assist_parameters_foreground"; //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/StructuredTextEditorPreferencePage.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/StructuredTextEditorPreferencePage.java
index 18bbd59..560ee09 100644
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/StructuredTextEditorPreferencePage.java
+++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/StructuredTextEditorPreferencePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
+ * Copyright (c) 2001, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -63,7 +63,7 @@
private ColorEditor fAppearanceColorEditor;
private List fAppearanceColorList;
- private final String[][] fAppearanceColorListModel = new String[][]{{SSEUIMessages.StructuredTextEditorPreferencePage_2, EditorPreferenceNames.MATCHING_BRACKETS_COLOR}}; //$NON-NLS-1$
+ private final String[][] fAppearanceColorListModel = new String[][]{{SSEUIMessages.StructuredTextEditorPreferencePage_2, EditorPreferenceNames.MATCHING_BRACKETS_COLOR}, {SSEUIMessages.StructuredTextEditorPreferencePage_41, EditorPreferenceNames.CODEASSIST_PROPOSALS_BACKGROUND}, {SSEUIMessages.StructuredTextEditorPreferencePage_42, EditorPreferenceNames.CODEASSIST_PROPOSALS_FOREGROUND}, {SSEUIMessages.StructuredTextEditorPreferencePage_43, EditorPreferenceNames.CODEASSIST_PARAMETERS_BACKGROUND}, {SSEUIMessages.StructuredTextEditorPreferencePage_44, EditorPreferenceNames.CODEASSIST_PARAMETERS_FOREGROUND}}; //$NON-NLS-1$
private Map fCheckBoxes = new HashMap();
private SelectionListener fCheckBoxListener = new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
@@ -183,7 +183,7 @@
fAppearanceColorList = new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
- gd.heightHint = convertHeightInCharsToPixels(5);
+ gd.heightHint = convertHeightInCharsToPixels(7);
fAppearanceColorList.setLayoutData(gd);
Composite stylesComposite = new Composite(editorComposite, SWT.NONE);
@@ -293,6 +293,11 @@
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, EditorPreferenceNames.SHOW_UNKNOWN_CONTENT_TYPE_MSG));
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IStructuredTextFoldingProvider.FOLDING_ENABLED));
+
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, EditorPreferenceNames.CODEASSIST_PROPOSALS_BACKGROUND));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, EditorPreferenceNames.CODEASSIST_PROPOSALS_FOREGROUND));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, EditorPreferenceNames.CODEASSIST_PARAMETERS_BACKGROUND));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, EditorPreferenceNames.CODEASSIST_PARAMETERS_FOREGROUND));
OverlayPreferenceStore.OverlayKey[] keys = new OverlayPreferenceStore.OverlayKey[overlayKeys.size()];
overlayKeys.toArray(keys);