Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 134073 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/wst/sse/ui/StructuredTextViewerConfiguration.java (-1 / +14 lines)
Lines 42-47 Link Here
42
import org.eclipse.jface.text.source.Annotation;
42
import org.eclipse.jface.text.source.Annotation;
43
import org.eclipse.jface.text.source.IAnnotationHover;
43
import org.eclipse.jface.text.source.IAnnotationHover;
44
import org.eclipse.jface.text.source.ISourceViewer;
44
import org.eclipse.jface.text.source.ISourceViewer;
45
import org.eclipse.jface.util.IPropertyChangeListener;
46
import org.eclipse.jface.util.PropertyChangeEvent;
45
import org.eclipse.jface.viewers.ILabelProvider;
47
import org.eclipse.jface.viewers.ILabelProvider;
46
import org.eclipse.swt.SWT;
48
import org.eclipse.swt.SWT;
47
import org.eclipse.swt.graphics.Color;
49
import org.eclipse.swt.graphics.Color;
Lines 87-93 Link Here
87
 * @see org.eclipse.wst.sse.ui.internal.StructuredTextViewer
89
 * @see org.eclipse.wst.sse.ui.internal.StructuredTextViewer
88
 * @since 1.0
90
 * @since 1.0
89
 */
91
 */
90
public class StructuredTextViewerConfiguration extends TextSourceViewerConfiguration {
92
public class StructuredTextViewerConfiguration extends TextSourceViewerConfiguration implements IPropertyChangeListener {
91
	/*
93
	/*
92
	 * One instance per configuration because creating a second assistant that
94
	 * One instance per configuration because creating a second assistant that
93
	 * is added to a viewer can cause odd key-eating by the wrong one.
95
	 * is added to a viewer can cause odd key-eating by the wrong one.
Lines 117-122 Link Here
117
		// initialize fPreferenceStore with same preference store used in
119
		// initialize fPreferenceStore with same preference store used in
118
		// StructuredTextEditor
120
		// StructuredTextEditor
119
		fPreferenceStore = createCombinedPreferenceStore();
121
		fPreferenceStore = createCombinedPreferenceStore();
122
		fPreferenceStore.addPropertyChangeListener(this);
120
	}
123
	}
121
124
122
	/**
125
	/**
Lines 273-278 Link Here
273
				color = getColor(EditorPreferenceNames.CODEASSIST_PARAMETERS_FOREGROUND);
276
				color = getColor(EditorPreferenceNames.CODEASSIST_PARAMETERS_FOREGROUND);
274
				fContentAssistant.setContextInformationPopupForeground(color);
277
				fContentAssistant.setContextInformationPopupForeground(color);
275
				fContentAssistant.setContextSelectorForeground(color);
278
				fContentAssistant.setContextSelectorForeground(color);
279
				
280
				fContentAssistant.enableAutoInsert(fPreferenceStore.getBoolean(EditorPreferenceNames.INSERT_SINGLE_SUGGESTION));
276
			}
281
			}
277
		}
282
		}
278
283
Lines 687-690 Link Here
687
	public void setHighlighter(ReconcilerHighlighter highlighter) {
692
	public void setHighlighter(ReconcilerHighlighter highlighter) {
688
		fHighlighter = highlighter;
693
		fHighlighter = highlighter;
689
	}
694
	}
695
696
	public void propertyChange(PropertyChangeEvent event) {
697
		if(fContentAssistant != null && EditorPreferenceNames.INSERT_SINGLE_SUGGESTION.equals(event.getProperty())) {
698
			Object value = event.getNewValue();
699
			if (value instanceof Boolean)
700
				fContentAssistant.enableAutoInsert(((Boolean) value).booleanValue());
701
		}
702
	}
690
}
703
}
(-)src/org/eclipse/wst/sse/ui/internal/SSEUIPluginResources.properties (+1 lines)
Lines 175-180 Link Here
175
StructuredTextEditorPreferencePage_37=Empty input
175
StructuredTextEditorPreferencePage_37=Empty input
176
StructuredTextEditorPreferencePage_38=is not a valid input.
176
StructuredTextEditorPreferencePage_38=is not a valid input.
177
StructuredTextEditorPreferencePage_39=Inform when unsupported content type is in editor
177
StructuredTextEditorPreferencePage_39=Inform when unsupported content type is in editor
178
StructuredTextEditorPreferencePage_4=Insert single proposals automatically
178
StructuredTextEditorPreferencePage_40=Also see the <a>''{0}''</a> preferences.
179
StructuredTextEditorPreferencePage_40=Also see the <a>''{0}''</a> preferences.
179
StructuredTextEditorPreferencePage_41=Completion proposal background
180
StructuredTextEditorPreferencePage_41=Completion proposal background
180
StructuredTextEditorPreferencePage_42=Completion proposal foreground
181
StructuredTextEditorPreferencePage_42=Completion proposal foreground
(-)src/org/eclipse/wst/sse/ui/internal/PreferenceInitializer.java (+2 lines)
Lines 75-80 Link Here
75
		PreferenceConverter.setDefault(store, EditorPreferenceNames.CODEASSIST_PROPOSALS_FOREGROUND, ColorHelper.findRGB(registry, EditorPreferenceNames.CODEASSIST_PROPOSALS_FOREGROUND, new RGB(0, 0, 0)));
75
		PreferenceConverter.setDefault(store, EditorPreferenceNames.CODEASSIST_PROPOSALS_FOREGROUND, ColorHelper.findRGB(registry, EditorPreferenceNames.CODEASSIST_PROPOSALS_FOREGROUND, new RGB(0, 0, 0)));
76
		PreferenceConverter.setDefault(store, EditorPreferenceNames.CODEASSIST_PARAMETERS_BACKGROUND, ColorHelper.findRGB(registry, EditorPreferenceNames.CODEASSIST_PARAMETERS_BACKGROUND, new RGB(255, 255, 255)));
76
		PreferenceConverter.setDefault(store, EditorPreferenceNames.CODEASSIST_PARAMETERS_BACKGROUND, ColorHelper.findRGB(registry, EditorPreferenceNames.CODEASSIST_PARAMETERS_BACKGROUND, new RGB(255, 255, 255)));
77
		PreferenceConverter.setDefault(store, EditorPreferenceNames.CODEASSIST_PARAMETERS_FOREGROUND, ColorHelper.findRGB(registry, EditorPreferenceNames.CODEASSIST_PARAMETERS_FOREGROUND, new RGB(0, 0, 0)));
77
		PreferenceConverter.setDefault(store, EditorPreferenceNames.CODEASSIST_PARAMETERS_FOREGROUND, ColorHelper.findRGB(registry, EditorPreferenceNames.CODEASSIST_PARAMETERS_FOREGROUND, new RGB(0, 0, 0)));
78
79
		store.setDefault(EditorPreferenceNames.INSERT_SINGLE_SUGGESTION, true);
78
	}
80
	}
79
81
80
	private void setMatchingBracketsPreferences(IPreferenceStore store, ColorRegistry registry) {
82
	private void setMatchingBracketsPreferences(IPreferenceStore store, ColorRegistry registry) {
(-)src/org/eclipse/wst/sse/ui/internal/SSEUIMessages.java (+1 lines)
Lines 201-206 Link Here
201
	public static String StructuredTextEditorPreferencePage_30;
201
	public static String StructuredTextEditorPreferencePage_30;
202
	public static String StructuredTextEditorPreferencePage_37;
202
	public static String StructuredTextEditorPreferencePage_37;
203
	public static String StructuredTextEditorPreferencePage_38;
203
	public static String StructuredTextEditorPreferencePage_38;
204
	public static String StructuredTextEditorPreferencePage_4;
204
	public static String StructuredTextEditorPreferencePage_40;
205
	public static String StructuredTextEditorPreferencePage_40;
205
	public static String StructuredTextEditorPreferencePage_41;
206
	public static String StructuredTextEditorPreferencePage_41;
206
	public static String StructuredTextEditorPreferencePage_42;
207
	public static String StructuredTextEditorPreferencePage_42;
(-)src/org/eclipse/wst/sse/ui/internal/preferences/EditorPreferenceNames.java (-1 / +9 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
2
 * Copyright (c) 2005, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 145-148 Link Here
145
	 * @see org.eclipse.jface.preference.PreferenceConverter
145
	 * @see org.eclipse.jface.preference.PreferenceConverter
146
	 */
146
	 */
147
	public final static String CODEASSIST_PARAMETERS_FOREGROUND = "content_assist_parameters_foreground"; //$NON-NLS-1$
147
	public final static String CODEASSIST_PARAMETERS_FOREGROUND = "content_assist_parameters_foreground"; //$NON-NLS-1$
148
	
149
	/**
150
	 * A named preference that controls whether content assist will automatically insert single suggestions
151
	 * <p>
152
	 * Value is of type <code>Boolean</code>.
153
	 * </p>
154
	 */
155
	public final static String INSERT_SINGLE_SUGGESTION = "insertSingleSuggestion"; //$NON-NLS-1$
148
}
156
}
(-)src/org/eclipse/wst/sse/ui/internal/preferences/ui/StructuredTextEditorPreferencePage.java (-1 / +6 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2001, 2007 IBM Corporation and others.
2
 * Copyright (c) 2001, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 159-164 Link Here
159
		label = SSEUIMessages.StructuredTextEditorPreferencePage_3;
159
		label = SSEUIMessages.StructuredTextEditorPreferencePage_3;
160
		addCheckBox(appearanceComposite, label, IStructuredTextFoldingProvider.FOLDING_ENABLED, 0);
160
		addCheckBox(appearanceComposite, label, IStructuredTextFoldingProvider.FOLDING_ENABLED, 0);
161
161
162
		label = SSEUIMessages.StructuredTextEditorPreferencePage_4;
163
		addCheckBox(appearanceComposite, label, EditorPreferenceNames.INSERT_SINGLE_SUGGESTION, 0);
164
162
		Label l = new Label(appearanceComposite, SWT.LEFT);
165
		Label l = new Label(appearanceComposite, SWT.LEFT);
163
		GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
166
		GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
164
		gd.horizontalSpan = 2;
167
		gd.horizontalSpan = 2;
Lines 294-299 Link Here
294
297
295
		overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IStructuredTextFoldingProvider.FOLDING_ENABLED));
298
		overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IStructuredTextFoldingProvider.FOLDING_ENABLED));
296
		
299
		
300
		overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, EditorPreferenceNames.INSERT_SINGLE_SUGGESTION));
301
297
		overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, EditorPreferenceNames.CODEASSIST_PROPOSALS_BACKGROUND));
302
		overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, EditorPreferenceNames.CODEASSIST_PROPOSALS_BACKGROUND));
298
		overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, EditorPreferenceNames.CODEASSIST_PROPOSALS_FOREGROUND));
303
		overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, EditorPreferenceNames.CODEASSIST_PROPOSALS_FOREGROUND));
299
		overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, EditorPreferenceNames.CODEASSIST_PARAMETERS_BACKGROUND));
304
		overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, EditorPreferenceNames.CODEASSIST_PARAMETERS_BACKGROUND));
(-)src/org/eclipse/jst/jsp/ui/internal/contentassist/CustomTemplateProposal.java (-2 / +7 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2006 IBM Corporation and others.
2
 * Copyright (c) 2005, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 12-17 Link Here
12
package org.eclipse.jst.jsp.ui.internal.contentassist;
12
package org.eclipse.jst.jsp.ui.internal.contentassist;
13
13
14
import org.eclipse.jface.text.IRegion;
14
import org.eclipse.jface.text.IRegion;
15
import org.eclipse.jface.text.contentassist.ICompletionProposalExtension4;
15
import org.eclipse.jface.text.templates.Template;
16
import org.eclipse.jface.text.templates.Template;
16
import org.eclipse.jface.text.templates.TemplateContext;
17
import org.eclipse.jface.text.templates.TemplateContext;
17
import org.eclipse.jface.text.templates.TemplateProposal;
18
import org.eclipse.jface.text.templates.TemplateProposal;
Lines 25-31 Link Here
25
 * 
26
 * 
26
 * @plannedfor 1.0
27
 * @plannedfor 1.0
27
 */
28
 */
28
class CustomTemplateProposal extends TemplateProposal implements IRelevanceCompletionProposal {
29
class CustomTemplateProposal extends TemplateProposal implements IRelevanceCompletionProposal, ICompletionProposalExtension4 {
29
	// copies of this class exist in:
30
	// copies of this class exist in:
30
	// org.eclipse.jst.jsp.ui.internal.contentassist
31
	// org.eclipse.jst.jsp.ui.internal.contentassist
31
	// org.eclipse.wst.html.ui.internal.contentassist
32
	// org.eclipse.wst.html.ui.internal.contentassist
Lines 39-42 Link Here
39
		String additionalInfo = super.getAdditionalProposalInfo();
40
		String additionalInfo = super.getAdditionalProposalInfo();
40
		return StringUtils.convertToHTMLContent(additionalInfo);
41
		return StringUtils.convertToHTMLContent(additionalInfo);
41
	}
42
	}
43
44
	public boolean isAutoInsertable() {
45
		return false;
46
	}
42
}
47
}
(-)src/org/eclipse/wst/xml/ui/internal/contentassist/CustomTemplateProposal.java (-2 / +7 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2006 IBM Corporation and others.
2
 * Copyright (c) 2005, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 12-17 Link Here
12
package org.eclipse.wst.xml.ui.internal.contentassist;
12
package org.eclipse.wst.xml.ui.internal.contentassist;
13
13
14
import org.eclipse.jface.text.IRegion;
14
import org.eclipse.jface.text.IRegion;
15
import org.eclipse.jface.text.contentassist.ICompletionProposalExtension4;
15
import org.eclipse.jface.text.templates.Template;
16
import org.eclipse.jface.text.templates.Template;
16
import org.eclipse.jface.text.templates.TemplateContext;
17
import org.eclipse.jface.text.templates.TemplateContext;
17
import org.eclipse.jface.text.templates.TemplateProposal;
18
import org.eclipse.jface.text.templates.TemplateProposal;
Lines 23-29 Link Here
23
 * Purpose of this class is to make the additional proposal info into content
24
 * Purpose of this class is to make the additional proposal info into content
24
 * fit for an HTML viewer (by escaping characters)
25
 * fit for an HTML viewer (by escaping characters)
25
 */
26
 */
26
class CustomTemplateProposal extends TemplateProposal implements IRelevanceCompletionProposal {
27
class CustomTemplateProposal extends TemplateProposal implements IRelevanceCompletionProposal, ICompletionProposalExtension4 {
27
	// copies of this class exist in:
28
	// copies of this class exist in:
28
	// org.eclipse.jst.jsp.ui.internal.contentassist
29
	// org.eclipse.jst.jsp.ui.internal.contentassist
29
	// org.eclipse.wst.html.ui.internal.contentassist
30
	// org.eclipse.wst.html.ui.internal.contentassist
Lines 37-40 Link Here
37
		String additionalInfo = super.getAdditionalProposalInfo();
38
		String additionalInfo = super.getAdditionalProposalInfo();
38
		return StringUtils.convertToHTMLContent(additionalInfo);
39
		return StringUtils.convertToHTMLContent(additionalInfo);
39
	}
40
	}
41
42
	public boolean isAutoInsertable() {
43
		return false;
44
	}
40
}
45
}
(-)src/org/eclipse/wst/html/ui/internal/contentassist/CustomTemplateProposal.java (-2 / +7 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2006 IBM Corporation and others.
2
 * Copyright (c) 2005, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 12-17 Link Here
12
package org.eclipse.wst.html.ui.internal.contentassist;
12
package org.eclipse.wst.html.ui.internal.contentassist;
13
13
14
import org.eclipse.jface.text.IRegion;
14
import org.eclipse.jface.text.IRegion;
15
import org.eclipse.jface.text.contentassist.ICompletionProposalExtension4;
15
import org.eclipse.jface.text.templates.Template;
16
import org.eclipse.jface.text.templates.Template;
16
import org.eclipse.jface.text.templates.TemplateContext;
17
import org.eclipse.jface.text.templates.TemplateContext;
17
import org.eclipse.jface.text.templates.TemplateProposal;
18
import org.eclipse.jface.text.templates.TemplateProposal;
Lines 23-29 Link Here
23
 * Purpose of this class is to make the additional proposal info into content
24
 * Purpose of this class is to make the additional proposal info into content
24
 * fit for an HTML viewer (by escaping characters)
25
 * fit for an HTML viewer (by escaping characters)
25
 */
26
 */
26
class CustomTemplateProposal extends TemplateProposal implements IRelevanceCompletionProposal {
27
class CustomTemplateProposal extends TemplateProposal implements IRelevanceCompletionProposal, ICompletionProposalExtension4 {
27
	// copies of this class exist in:
28
	// copies of this class exist in:
28
	// org.eclipse.jst.jsp.ui.internal.contentassist
29
	// org.eclipse.jst.jsp.ui.internal.contentassist
29
	// org.eclipse.wst.html.ui.internal.contentassist
30
	// org.eclipse.wst.html.ui.internal.contentassist
Lines 37-40 Link Here
37
		String additionalInfo = super.getAdditionalProposalInfo();
38
		String additionalInfo = super.getAdditionalProposalInfo();
38
		return StringUtils.convertToHTMLContent(additionalInfo);
39
		return StringUtils.convertToHTMLContent(additionalInfo);
39
	}
40
	}
41
42
	public boolean isAutoInsertable() {
43
		return false;
44
	}
40
}
45
}

Return to bug 134073