[134073] [content assist] Control+Space Bar doesn't auto-fill text when there's only one option
diff --git a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/StructuredTextViewerConfigurationJSP.java b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/StructuredTextViewerConfigurationJSP.java
index e739cd6..02d25e1 100644
--- a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/StructuredTextViewerConfigurationJSP.java
+++ b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/StructuredTextViewerConfigurationJSP.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2011 IBM Corporation and others.
+ * Copyright (c) 2004, 2012 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
@@ -23,7 +23,9 @@
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.IAutoEditStrategy;
import org.eclipse.jface.text.ITextDoubleClickStrategy;
+import org.eclipse.jface.text.contentassist.ContentAssistant;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.text.contentassist.IContentAssistant;
import org.eclipse.jface.text.formatter.IContentFormatter;
import org.eclipse.jface.text.formatter.MultiPassContentFormatter;
import org.eclipse.jface.text.source.ISourceViewer;
@@ -31,11 +33,13 @@
import org.eclipse.jst.jsp.core.internal.provisional.contenttype.ContentTypeIdForJSP;
import org.eclipse.jst.jsp.core.internal.text.StructuredTextPartitionerForJSP;
import org.eclipse.jst.jsp.core.text.IJSPPartitions;
+import org.eclipse.jst.jsp.ui.internal.JSPUIPlugin;
import org.eclipse.jst.jsp.ui.internal.autoedit.AutoEditStrategyForTabs;
import org.eclipse.jst.jsp.ui.internal.autoedit.StructuredAutoEditStrategyJSP;
import org.eclipse.jst.jsp.ui.internal.autoedit.StructuredAutoEditStrategyJSPJava;
import org.eclipse.jst.jsp.ui.internal.contentassist.JSPStructuredContentAssistProcessor;
import org.eclipse.jst.jsp.ui.internal.format.FormattingStrategyJSPJava;
+import org.eclipse.jst.jsp.ui.internal.preferences.JSPUIPreferenceNames;
import org.eclipse.jst.jsp.ui.internal.style.LineStyleProviderForJSP;
import org.eclipse.jst.jsp.ui.internal.style.java.LineStyleProviderForJava;
import org.eclipse.jst.jsp.ui.internal.style.jspel.LineStyleProviderForJSPEL;
@@ -179,6 +183,14 @@
return fConfiguredContentTypes;
}
+ public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
+ final IContentAssistant assistant = super.getContentAssistant(sourceViewer);
+ if (assistant instanceof ContentAssistant) {
+ ((ContentAssistant) assistant).enableAutoInsert(JSPUIPlugin.getInstance().getPreferenceStore().getBoolean(JSPUIPreferenceNames.INSERT_SINGLE_SUGGESTION));
+ }
+ return assistant;
+ }
+
/**
* @see org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration#getContentAssistProcessors(
* org.eclipse.jface.text.source.ISourceViewer, java.lang.String)
diff --git a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/contentassist/CustomTemplateProposal.java b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/contentassist/CustomTemplateProposal.java
index 912121e..98b3b2a 100644
--- a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/contentassist/CustomTemplateProposal.java
+++ b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/contentassist/CustomTemplateProposal.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 2012 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
@@ -12,6 +12,7 @@
package org.eclipse.jst.jsp.ui.internal.contentassist;
import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.contentassist.ICompletionProposalExtension4;
import org.eclipse.jface.text.templates.Template;
import org.eclipse.jface.text.templates.TemplateContext;
import org.eclipse.jface.text.templates.TemplateProposal;
@@ -25,7 +26,7 @@
*
* @plannedfor 1.0
*/
-class CustomTemplateProposal extends TemplateProposal implements IRelevanceCompletionProposal {
+class CustomTemplateProposal extends TemplateProposal implements IRelevanceCompletionProposal, ICompletionProposalExtension4 {
// copies of this class exist in:
// org.eclipse.jst.jsp.ui.internal.contentassist
// org.eclipse.wst.html.ui.internal.contentassist
@@ -39,4 +40,8 @@
String additionalInfo = super.getAdditionalProposalInfo();
return StringUtils.convertToHTMLContent(additionalInfo);
}
+
+ public boolean isAutoInsertable() {
+ return false;
+ }
}
diff --git a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/preferences/JSPUIPreferenceInitializer.java b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/preferences/JSPUIPreferenceInitializer.java
index 8ae90cc..286616a 100644
--- a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/preferences/JSPUIPreferenceInitializer.java
+++ b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/preferences/JSPUIPreferenceInitializer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2010 IBM Corporation and others.
+ * Copyright (c) 2005, 2012 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
@@ -111,6 +111,7 @@
"org.eclipse.jst.jsp.ui.proposalCategory.jspJava\0" +
"org.eclipse.wst.css.ui.proposalCategory.css");
store.setDefault(JSPUIPreferenceNames.AUTO_IMPORT_INSERT, true);
+ store.setDefault(JSPUIPreferenceNames.INSERT_SINGLE_SUGGESTION, true);
}
}
diff --git a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/preferences/JSPUIPreferenceNames.java b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/preferences/JSPUIPreferenceNames.java
index e6176c2..6586d4e 100644
--- a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/preferences/JSPUIPreferenceNames.java
+++ b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/preferences/JSPUIPreferenceNames.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2010 IBM Corporation and others.
+ * Copyright (c) 2005, 2012 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
@@ -176,4 +176,12 @@
* </p>
*/
public static final String AUTO_IMPORT_INSERT = "autoImportinsertion"; //$NON-NLS-1$
+
+ /**
+ * <p>preference key to store the option for auto insertion of single suggestions</p>
+ * <p>
+ * Value is of type <code>boolean</code>
+ * </p>
+ */
+ public static final String INSERT_SINGLE_SUGGESTION = "insertSingleSuggestion"; //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/preferences/ui/JSPContentAssistPreferencePage.java b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/preferences/ui/JSPContentAssistPreferencePage.java
index 66c2de9..3022a0a 100644
--- a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/preferences/ui/JSPContentAssistPreferencePage.java
+++ b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/preferences/ui/JSPContentAssistPreferencePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
+ * Copyright (c) 2010, 2012 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
@@ -25,6 +25,7 @@
import org.eclipse.wst.sse.ui.internal.preferences.ui.AbstractPreferencePage;
import org.eclipse.wst.sse.ui.preferences.CodeAssistCyclingConfigurationBlock;
import org.eclipse.wst.sse.ui.preferences.ICompletionProposalCategoriesConfigurationWriter;
+import org.eclipse.wst.xml.ui.internal.XMLUIMessages;
/**
* <p>Defines the preference page for allowing the user to change the content
@@ -40,6 +41,8 @@
/** configuration block for changing preference having to do with the content assist categories */
private CodeAssistCyclingConfigurationBlock fConfigurationBlock;
+
+ private Button fInsertSingleProposals;
/**
* @see org.eclipse.wst.sse.ui.internal.preferences.ui.AbstractPreferencePage#createContents(org.eclipse.swt.widgets.Composite)
@@ -104,7 +107,8 @@
fAutoImport = createCheckBox(group, JSPUIMessages.JSPCodeAssist_Auto_Import);
((GridData) fAutoImport.getLayoutData()).horizontalSpan = 2;
-
+ fInsertSingleProposals = createCheckBox(group, XMLUIMessages.Insert_single_proposals);
+ ((GridData) fInsertSingleProposals.getLayoutData()).horizontalSpan = 2;
}
/**
@@ -130,6 +134,7 @@
*/
private void storeValuesForAutoInsertionGroup() {
getPreferenceStore().setValue(JSPUIPreferenceNames.AUTO_IMPORT_INSERT, (fAutoImport != null) ? fAutoImport.getSelection() : false);
+ getPreferenceStore().setValue(JSPUIPreferenceNames.INSERT_SINGLE_SUGGESTION, (fInsertSingleProposals != null) ? fInsertSingleProposals.getSelection() : false);
}
/**
@@ -146,6 +151,7 @@
*/
private void initializeValuesForAutoInsertionGroup() {
initCheckbox(fAutoImport, JSPUIPreferenceNames.AUTO_IMPORT_INSERT);
+ initCheckbox(fInsertSingleProposals, JSPUIPreferenceNames.INSERT_SINGLE_SUGGESTION);
}
/**
@@ -162,6 +168,7 @@
*/
private void performDefaultsForAutoInsertionGroup() {
defaultCheckbox(fAutoImport, JSPUIPreferenceNames.AUTO_IMPORT_INSERT);
+ defaultCheckbox(fInsertSingleProposals, JSPUIPreferenceNames.INSERT_SINGLE_SUGGESTION);
}
/**
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/StructuredTextViewerConfigurationCSS.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/StructuredTextViewerConfigurationCSS.java
index 764be1e..f59020d 100644
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/StructuredTextViewerConfigurationCSS.java
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/StructuredTextViewerConfigurationCSS.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2011 IBM Corporation and others.
+ * Copyright (c) 2004, 2012 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
@@ -17,7 +17,9 @@
import org.eclipse.core.runtime.Preferences;
import org.eclipse.jface.text.IAutoEditStrategy;
+import org.eclipse.jface.text.contentassist.ContentAssistant;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.text.contentassist.IContentAssistant;
import org.eclipse.jface.text.formatter.IContentFormatter;
import org.eclipse.jface.text.formatter.MultiPassContentFormatter;
import org.eclipse.jface.text.source.ISourceViewer;
@@ -26,7 +28,9 @@
import org.eclipse.wst.css.core.internal.preferences.CSSCorePreferenceNames;
import org.eclipse.wst.css.core.internal.provisional.contenttype.ContentTypeIdForCSS;
import org.eclipse.wst.css.core.text.ICSSPartitions;
+import org.eclipse.wst.css.ui.internal.CSSUIPlugin;
import org.eclipse.wst.css.ui.internal.contentassist.CSSStructuredContentAssistProcessor;
+import org.eclipse.wst.css.ui.internal.preferences.CSSUIPreferenceNames;
import org.eclipse.wst.css.ui.internal.style.LineStyleProviderForCSS;
import org.eclipse.wst.sse.core.text.IStructuredPartitions;
import org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration;
@@ -79,7 +83,15 @@
}
return fConfiguredContentTypes;
}
-
+
+ public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
+ final IContentAssistant assistant = super.getContentAssistant(sourceViewer);
+ if (assistant instanceof ContentAssistant) {
+ ((ContentAssistant) assistant).enableAutoInsert(CSSUIPlugin.getDefault().getPreferenceStore().getBoolean(CSSUIPreferenceNames.INSERT_SINGLE_SUGGESTION));
+ }
+ return assistant;
+ }
+
/**
* @see org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration#getContentAssistProcessors(
* org.eclipse.jface.text.source.ISourceViewer, java.lang.String)
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/CSSUIPreferenceInitializer.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/CSSUIPreferenceInitializer.java
index b5ab212..f31a271 100644
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/CSSUIPreferenceInitializer.java
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/CSSUIPreferenceInitializer.java
@@ -93,6 +93,8 @@
store.setDefault(CSSUIPreferenceNames.CONTENT_ASSIST_OWN_PAGE_SORT_ORDER,
"org.eclipse.wst.css.ui.proposalCategory.cssTemplates\0"+
"org.eclipse.wst.css.ui.proposalCategory.css");
+
+ store.setDefault(CSSUIPreferenceNames.INSERT_SINGLE_SUGGESTION, true);
}
}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/CSSUIPreferenceNames.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/CSSUIPreferenceNames.java
index 1dc5129..def2767 100644
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/CSSUIPreferenceNames.java
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/CSSUIPreferenceNames.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2010 IBM Corporation and others.
+ * Copyright (c) 2005, 2012 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
@@ -76,4 +76,12 @@
* character (<tt>\0</tt>) in the desired sort order.</p>
*/
public static final String CONTENT_ASSIST_DEFAULT_PAGE_SORT_ORDER= "css_content_assist_default_page_sort_order"; //$NON-NLS-1$
+
+ /**
+ * <p>preference key to store the option for auto insertion of single suggestions</p>
+ * <p>
+ * Value is of type <code>boolean</code>
+ * </p>
+ */
+ public static final String INSERT_SINGLE_SUGGESTION = "insertSingleSuggestion"; //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/ui/CSSContentAssistPreferencePage.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/ui/CSSContentAssistPreferencePage.java
index 0bf18af..6c7a1a4 100644
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/ui/CSSContentAssistPreferencePage.java
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/ui/CSSContentAssistPreferencePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
+ * Copyright (c) 2010, 2012 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,15 +11,20 @@
package org.eclipse.wst.css.ui.internal.preferences.ui;
import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.wst.css.ui.internal.CSSUIPlugin;
+import org.eclipse.wst.css.ui.internal.preferences.CSSUIPreferenceNames;
import org.eclipse.wst.sse.ui.internal.Logger;
import org.eclipse.wst.sse.ui.internal.contentassist.CompletionProposoalCatigoriesConfigurationRegistry;
import org.eclipse.wst.sse.ui.internal.preferences.ui.AbstractPreferencePage;
import org.eclipse.wst.sse.ui.preferences.CodeAssistCyclingConfigurationBlock;
import org.eclipse.wst.sse.ui.preferences.ICompletionProposalCategoriesConfigurationWriter;
+import org.eclipse.wst.xml.ui.internal.XMLUIMessages;
/**
* <p>Defines the preference page for allowing the user to change the content
@@ -32,6 +37,8 @@
/** configuration block for changing preference having to do with the content assist categories */
private CodeAssistCyclingConfigurationBlock fConfigurationBlock;
+
+ private Button fInsertSingleProposals;
/**
* @see org.eclipse.wst.sse.ui.internal.preferences.ui.AbstractPreferencePage#createContents(org.eclipse.swt.widgets.Composite)
@@ -39,6 +46,7 @@
protected Control createContents(Composite parent) {
final Composite composite = super.createComposite(parent, 1);
+ createContentsForInsertionGroup(composite);
createContentsForCyclingGroup(composite);
setSize(composite);
@@ -52,6 +60,7 @@
*/
protected void performDefaults() {
performDefaultsForCyclingGroup();
+ performDefaultsForInsertionGroup();
validateValues();
enableValues();
@@ -64,6 +73,7 @@
*/
protected void initializeValues() {
initializeValuesForCyclingGroup();
+ initializeValuesForInsertionGroup();
}
/**
@@ -71,6 +81,7 @@
*/
protected void storeValues() {
storeValuesForCyclingGroup();
+ storeValuesForInsertionGroup();
}
/**
@@ -79,7 +90,16 @@
protected IPreferenceStore doGetPreferenceStore() {
return CSSUIPlugin.getDefault().getPreferenceStore();
}
-
+
+ private void createContentsForInsertionGroup(Composite composite) {
+ Group group = createGroup(composite, 2);
+
+ group.setText(XMLUIMessages.Group_label_Insertion);
+
+ fInsertSingleProposals = createCheckBox(group, XMLUIMessages.Insert_single_proposals);
+ ((GridData) fInsertSingleProposals.getLayoutData()).horizontalSpan = 2;
+ }
+
/**
* <p>Create the contents for the content assist cycling preference group</p>
* @param parent {@link Composite} parent of the group
@@ -89,7 +109,7 @@
if(configurationWriter != null) {
fConfigurationBlock = new CodeAssistCyclingConfigurationBlock(CSS_CONTENT_TYPE_ID, configurationWriter);
- fConfigurationBlock.createContents(parent, null); //$NON-NLS-1$
+ fConfigurationBlock.createContents(parent, XMLUIMessages.XMLContentAssistPreferencePage_Cycling_UI_); //$NON-NLS-1$
} else {
Logger.log(Logger.ERROR, "There should be an ICompletionProposalCategoriesConfigurationWriter" + //$NON-NLS-1$
" specified for the CSS content type, but can't fine it, thus can't create user" + //$NON-NLS-1$
@@ -105,7 +125,11 @@
fConfigurationBlock.storeValues();
}
}
-
+
+ private void storeValuesForInsertionGroup() {
+ getPreferenceStore().setValue(CSSUIPreferenceNames.INSERT_SINGLE_SUGGESTION, (fInsertSingleProposals != null) ? fInsertSingleProposals.getSelection() : false);
+ }
+
/**
* <p>Initialize the values for the cycling group</p>
*/
@@ -114,7 +138,11 @@
fConfigurationBlock.initializeValues();
}
}
-
+
+ private void initializeValuesForInsertionGroup() {
+ initCheckbox(fInsertSingleProposals, CSSUIPreferenceNames.INSERT_SINGLE_SUGGESTION);
+ }
+
/**
* <p>Load the defaults of the cycling group</p>
*/
@@ -123,4 +151,8 @@
fConfigurationBlock.performDefaults();
}
}
+
+ private void performDefaultsForInsertionGroup() {
+ defaultCheckbox(fInsertSingleProposals, CSSUIPreferenceNames.INSERT_SINGLE_SUGGESTION);
+ }
}
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/StructuredTextViewerConfigurationHTML.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/StructuredTextViewerConfigurationHTML.java
index a38409f..59fc466 100644
--- a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/StructuredTextViewerConfigurationHTML.java
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/StructuredTextViewerConfigurationHTML.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2010 IBM Corporation and others.
+ * Copyright (c) 2004, 2012 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
@@ -19,7 +19,9 @@
import org.eclipse.core.runtime.Preferences;
import org.eclipse.jface.text.IAutoEditStrategy;
import org.eclipse.jface.text.ITextDoubleClickStrategy;
+import org.eclipse.jface.text.contentassist.ContentAssistant;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.text.contentassist.IContentAssistant;
import org.eclipse.jface.text.formatter.IContentFormatter;
import org.eclipse.jface.text.formatter.MultiPassContentFormatter;
import org.eclipse.jface.text.source.ISourceViewer;
@@ -32,8 +34,10 @@
import org.eclipse.wst.html.core.internal.provisional.contenttype.ContentTypeIdForHTML;
import org.eclipse.wst.html.core.internal.text.StructuredTextPartitionerForHTML;
import org.eclipse.wst.html.core.text.IHTMLPartitions;
+import org.eclipse.wst.html.ui.internal.HTMLUIPlugin;
import org.eclipse.wst.html.ui.internal.autoedit.AutoEditStrategyForTabs;
import org.eclipse.wst.html.ui.internal.contentassist.HTMLStructuredContentAssistProcessor;
+import org.eclipse.wst.html.ui.internal.preferences.HTMLUIPreferenceNames;
import org.eclipse.wst.html.ui.internal.style.LineStyleProviderForHTML;
import org.eclipse.wst.sse.core.text.IStructuredPartitions;
import org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration;
@@ -118,6 +122,14 @@
return fConfiguredContentTypes;
}
+ public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
+ final IContentAssistant assistant = super.getContentAssistant(sourceViewer);
+ if (assistant instanceof ContentAssistant) {
+ ((ContentAssistant) assistant).enableAutoInsert(HTMLUIPlugin.getInstance().getPreferenceStore().getBoolean(HTMLUIPreferenceNames.INSERT_SINGLE_SUGGESTION));
+ }
+ return assistant;
+ }
+
protected IContentAssistProcessor[] getContentAssistProcessors(
ISourceViewer sourceViewer, String partitionType) {
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/CustomTemplateProposal.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/CustomTemplateProposal.java
index 6bb0f20..57bb697 100644
--- a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/CustomTemplateProposal.java
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/CustomTemplateProposal.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 2012 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
@@ -12,6 +12,7 @@
package org.eclipse.wst.html.ui.internal.contentassist;
import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.contentassist.ICompletionProposalExtension4;
import org.eclipse.jface.text.templates.Template;
import org.eclipse.jface.text.templates.TemplateContext;
import org.eclipse.jface.text.templates.TemplateProposal;
@@ -23,7 +24,7 @@
* Purpose of this class is to make the additional proposal info into content
* fit for an HTML viewer (by escaping characters)
*/
-class CustomTemplateProposal extends TemplateProposal implements IRelevanceCompletionProposal {
+class CustomTemplateProposal extends TemplateProposal implements IRelevanceCompletionProposal, ICompletionProposalExtension4 {
// copies of this class exist in:
// org.eclipse.jst.jsp.ui.internal.contentassist
// org.eclipse.wst.html.ui.internal.contentassist
@@ -37,4 +38,8 @@
String additionalInfo = super.getAdditionalProposalInfo();
return StringUtils.convertToHTMLContent(additionalInfo);
}
+
+ public boolean isAutoInsertable() {
+ return false;
+ }
}
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/preferences/HTMLUIPreferenceInitializer.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/preferences/HTMLUIPreferenceInitializer.java
index bc91ec6..7ce90da 100644
--- a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/preferences/HTMLUIPreferenceInitializer.java
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/preferences/HTMLUIPreferenceInitializer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2011 IBM Corporation and others.
+ * Copyright (c) 2006, 2012 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
@@ -38,6 +38,7 @@
store.setDefault(HTMLUIPreferenceNames.AUTO_PROPOSE, true);
store.setDefault(HTMLUIPreferenceNames.AUTO_PROPOSE_CODE, "<=");//$NON-NLS-1$
store.setDefault(HTMLUIPreferenceNames.AUTO_PROPOSE_DELAY, 500);
+ store.setDefault(HTMLUIPreferenceNames.INSERT_SINGLE_SUGGESTION, true);
// HTML Style Preferences
String NOBACKGROUNDBOLD = " | null | false"; //$NON-NLS-1$
String JUSTITALIC = " | null | false | true"; //$NON-NLS-1$
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/preferences/HTMLUIPreferenceNames.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/preferences/HTMLUIPreferenceNames.java
index 5a06096..4d18ca6 100644
--- a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/preferences/HTMLUIPreferenceNames.java
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/preferences/HTMLUIPreferenceNames.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 2012 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
@@ -167,4 +167,12 @@
* character (<tt>\0</tt>) in the desired sort order.</p>
*/
public static final String CONTENT_ASSIST_DEFAULT_PAGE_SORT_ORDER= "html_content_assist_default_page_sort_order"; //$NON-NLS-1$
+
+ /**
+ * <p>preference key to store the option for auto insertion of single suggestions</p>
+ * <p>
+ * Value is of type <code>boolean</code>
+ * </p>
+ */
+ public static final String INSERT_SINGLE_SUGGESTION = "insertSingleSuggestion"; //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/preferences/ui/HTMLContentAssistPreferencePage.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/preferences/ui/HTMLContentAssistPreferencePage.java
index bd2c0c5..57d5d37 100644
--- a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/preferences/ui/HTMLContentAssistPreferencePage.java
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/preferences/ui/HTMLContentAssistPreferencePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2011 IBM Corporation and others.
+ * Copyright (c) 2010, 2012 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
@@ -50,13 +50,16 @@
/** configuration block for changing preference having to do with the content assist categories */
private CodeAssistCyclingConfigurationBlock fConfigurationBlock;
+
+ private Button fInsertSingleProposals;
/**
* @see org.eclipse.wst.sse.ui.internal.preferences.ui.AbstractPreferencePage#createContents(org.eclipse.swt.widgets.Composite)
*/
protected Control createContents(Composite parent) {
final Composite composite = super.createComposite(parent, 1);
-
+
+ createContentsForInsertionGroup(composite);
createContentsForAutoActivationGroup(composite);
createContentsForCyclingGroup(composite);
@@ -66,12 +69,22 @@
return composite;
}
+ private void createContentsForInsertionGroup(Composite composite) {
+ Group group = createGroup(composite, 2);
+
+ group.setText(XMLUIMessages.Group_label_Insertion);
+
+ fInsertSingleProposals = createCheckBox(group, "Insert single proposals automatically");
+ ((GridData) fInsertSingleProposals.getLayoutData()).horizontalSpan = 2;
+ }
+
/**
* @see org.eclipse.wst.sse.ui.internal.preferences.ui.AbstractPreferencePage#performDefaults()
*/
protected void performDefaults() {
performDefaultsForAutoActivationGroup();
performDefaultsForCyclingGroup();
+ performDefaultsForInsertionGroup();
validateValues();
enableValues();
@@ -79,12 +92,21 @@
super.performDefaults();
}
+ private void performDefaultsForInsertionGroup() {
+ defaultCheckbox(fInsertSingleProposals, HTMLUIPreferenceNames.INSERT_SINGLE_SUGGESTION);
+ }
+
/**
* @see org.eclipse.wst.sse.ui.internal.preferences.ui.AbstractPreferencePage#initializeValues()
*/
protected void initializeValues() {
initializeValuesForAutoActivationGroup();
initializeValuesForCyclingGroup();
+ initializeValuesForInsertionGroup();
+ }
+
+ private void initializeValuesForInsertionGroup() {
+ initCheckbox(fInsertSingleProposals, HTMLUIPreferenceNames.INSERT_SINGLE_SUGGESTION);
}
/**
@@ -93,8 +115,13 @@
protected void storeValues() {
storeValuesForAutoActivationGroup();
storeValuesForCyclingGroup();
+ storeValuesForInsertionGroup();
}
+ private void storeValuesForInsertionGroup() {
+ getPreferenceStore().setValue(HTMLUIPreferenceNames.INSERT_SINGLE_SUGGESTION, (fInsertSingleProposals != null) ? fInsertSingleProposals.getSelection() : false);
+ }
+
/**
* @see org.eclipse.wst.sse.ui.internal.preferences.ui.AbstractPreferencePage#enableValues()
*/
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/StructuredTextViewerConfigurationXML.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/StructuredTextViewerConfigurationXML.java
index 2c11ee3..9da1daf 100644
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/StructuredTextViewerConfigurationXML.java
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/StructuredTextViewerConfigurationXML.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
+ * Copyright (c) 2001, 2012 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
@@ -20,7 +20,9 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Preferences;
import org.eclipse.jface.text.IAutoEditStrategy;
+import org.eclipse.jface.text.contentassist.ContentAssistant;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.text.contentassist.IContentAssistant;
import org.eclipse.jface.text.formatter.IContentFormatter;
import org.eclipse.jface.text.formatter.MultiPassContentFormatter;
import org.eclipse.jface.text.source.ISourceViewer;
@@ -34,9 +36,11 @@
import org.eclipse.wst.xml.core.internal.text.rules.StructuredTextPartitionerForXML;
import org.eclipse.wst.xml.core.text.IXMLPartitions;
import org.eclipse.wst.xml.ui.internal.XMLFormattingStrategy;
+import org.eclipse.wst.xml.ui.internal.XMLUIPlugin;
import org.eclipse.wst.xml.ui.internal.autoedit.AutoEditStrategyForTabs;
import org.eclipse.wst.xml.ui.internal.contentassist.XMLStructuredContentAssistProcessor;
import org.eclipse.wst.xml.ui.internal.contentoutline.JFaceNodeLabelProvider;
+import org.eclipse.wst.xml.ui.internal.preferences.XMLUIPreferenceNames;
import org.eclipse.wst.xml.ui.internal.style.LineStyleProviderForXML;
import org.w3c.dom.Attr;
import org.w3c.dom.Node;
@@ -100,6 +104,14 @@
return fConfiguredContentTypes;
}
+ public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
+ final IContentAssistant assistant = super.getContentAssistant(sourceViewer);
+ if (assistant instanceof ContentAssistant) {
+ ((ContentAssistant) assistant).enableAutoInsert(XMLUIPlugin.getInstance().getPreferenceStore().getBoolean(XMLUIPreferenceNames.INSERT_SINGLE_SUGGESTION));
+ }
+ return assistant;
+ }
+
/**
* @see org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration#getContentAssistProcessors(
* org.eclipse.jface.text.source.ISourceViewer, java.lang.String)
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIMessages.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIMessages.java
index 2250814..a9e6b5f 100644
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIMessages.java
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIMessages.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others. All rights reserved. This
+ * Copyright (c) 2005, 2012 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 http://www.eclipse.org/legal/epl-v10.html
@@ -204,6 +204,7 @@
public static String Compress_empty_element_tags_UI_;
public static String Insert_required_attributes_UI_;
public static String Insert_missing_tags_UI_;
+ public static String Insert_single_proposals;
public static String Quote_attribute_values_UI_;
public static String Format_source_UI_;
public static String Convert_EOL_codes_UI_;
@@ -244,6 +245,7 @@
public static String Format_comments;
public static String Format_comments_join_lines;
public static String Grammar_Constraints;
+ public static String Group_label_Insertion;
public static String Use_inferred_grammar_in_absence_of;
public static String Suggestion_Strategy;
public static String Suggestion_Strategy_Lax;
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIPluginResources.properties b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIPluginResources.properties
index 39af9c0..1f8f279 100644
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIPluginResources.properties
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIPluginResources.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2001, 2011 IBM Corporation and others.
+# Copyright (c) 2001, 2012 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
@@ -228,6 +228,7 @@
Compress_empty_element_tags_UI_=&Compress empty element tags
Insert_required_attributes_UI_=Insert &required attributes
Insert_missing_tags_UI_=&Insert missing tags
+Insert_single_proposals=&Insert single proposals automatically
Quote_attribute_values_UI_=&Quote attribute values
Format_source_UI_=&Format source
Convert_EOL_codes_UI_=Convert line &delimiters to
@@ -275,6 +276,7 @@
Format_comments=&Format comments
Format_comments_join_lines=&Join lines
Grammar_Constraints=Grammar Constraints
+Group_label_Insertion=Insertion
Use_inferred_grammar_in_absence_of=&Use inferred grammar in absence of DTD/Schema
Suggestion_Strategy=&Suggestion strategy:
Suggestion_Strategy_Lax=Lax
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/contentassist/CustomTemplateProposal.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/contentassist/CustomTemplateProposal.java
index f19dd90..81de306 100644
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/contentassist/CustomTemplateProposal.java
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/contentassist/CustomTemplateProposal.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 2012 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
@@ -12,6 +12,7 @@
package org.eclipse.wst.xml.ui.internal.contentassist;
import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.contentassist.ICompletionProposalExtension4;
import org.eclipse.jface.text.templates.Template;
import org.eclipse.jface.text.templates.TemplateContext;
import org.eclipse.jface.text.templates.TemplateProposal;
@@ -23,7 +24,7 @@
* Purpose of this class is to make the additional proposal info into content
* fit for an HTML viewer (by escaping characters)
*/
-class CustomTemplateProposal extends TemplateProposal implements IRelevanceCompletionProposal {
+class CustomTemplateProposal extends TemplateProposal implements IRelevanceCompletionProposal, ICompletionProposalExtension4 {
// copies of this class exist in:
// org.eclipse.jst.jsp.ui.internal.contentassist
// org.eclipse.wst.html.ui.internal.contentassist
@@ -37,4 +38,8 @@
String additionalInfo = super.getAdditionalProposalInfo();
return StringUtils.convertToHTMLContent(additionalInfo);
}
+
+ public boolean isAutoInsertable() {
+ return false;
+ }
}
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLContentAssistPreferencePage.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLContentAssistPreferencePage.java
index 28338d4..740ac59 100644
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLContentAssistPreferencePage.java
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLContentAssistPreferencePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2011 IBM Corporation and others.
+ * Copyright (c) 2010, 2012 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
@@ -54,13 +54,16 @@
/** configuration block for changing preference having to do with the content assist categories */
private CodeAssistCyclingConfigurationBlock fConfigurationBlock;
-
+
+ private Button fInsertSingleProposals;
+
/**
* @see org.eclipse.wst.sse.ui.internal.preferences.ui.AbstractPreferencePage#createContents(org.eclipse.swt.widgets.Composite)
*/
protected Control createContents(Composite parent) {
final Composite composite = super.createComposite(parent, 1);
+ createContentsForInsertionGroup(composite);
createContentsForAutoActivationGroup(composite);
createContentsForCyclingGroup(composite);
@@ -76,6 +79,7 @@
protected void performDefaults() {
performDefaultsForAutoActivationGroup();
performDefaultsForCyclingGroup();
+ performDefaultsForInsertionGroup();
validateValues();
enableValues();
@@ -89,6 +93,7 @@
protected void initializeValues() {
initializeValuesForAutoActivationGroup();
initializeValuesForCyclingGroup();
+ initializeValuesForInsertionGroup();
}
/**
@@ -97,6 +102,7 @@
protected void storeValues() {
storeValuesForAutoActivationGroup();
storeValuesForCyclingGroup();
+ storeValuesForInsertionGroup();
}
/**
@@ -187,6 +193,15 @@
}
}
+ private void createContentsForInsertionGroup(Composite composite) {
+ Group group = createGroup(composite, 2);
+
+ group.setText(XMLUIMessages.Group_label_Insertion);
+
+ fInsertSingleProposals = createCheckBox(group, XMLUIMessages.Insert_single_proposals);
+ ((GridData) fInsertSingleProposals.getLayoutData()).horizontalSpan = 2;
+ }
+
/**
* <p>Create the contents for the content assist cycling preference group</p>
* @param parent {@link Composite} parent of the group
@@ -222,7 +237,11 @@
fConfigurationBlock.storeValues();
}
}
-
+
+ private void storeValuesForInsertionGroup() {
+ getPreferenceStore().setValue(XMLUIPreferenceNames.INSERT_SINGLE_SUGGESTION, (fInsertSingleProposals != null) ? fInsertSingleProposals.getSelection() : false);
+ }
+
/**
* <p>Initialize the values for the auto activation group</p>
*/
@@ -247,7 +266,11 @@
fConfigurationBlock.initializeValues();
}
}
-
+
+ private void initializeValuesForInsertionGroup() {
+ initCheckbox(fInsertSingleProposals, XMLUIPreferenceNames.INSERT_SINGLE_SUGGESTION);
+ }
+
/**
* <p>Load the defaults for the auto activation group</p>
*/
@@ -272,7 +295,11 @@
fConfigurationBlock.performDefaults();
}
}
-
+
+ private void performDefaultsForInsertionGroup() {
+ defaultCheckbox(fInsertSingleProposals, XMLUIPreferenceNames.INSERT_SINGLE_SUGGESTION);
+ }
+
/**
* Return the currently selected suggestion strategy preference
*
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLUIPreferenceInitializer.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLUIPreferenceInitializer.java
index ce65015..2464218 100644
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLUIPreferenceInitializer.java
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLUIPreferenceInitializer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2011 IBM Corporation and others.
+ * Copyright (c) 2006, 2012 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
@@ -34,6 +34,7 @@
IPreferenceStore store = XMLUIPlugin.getDefault().getPreferenceStore();
ColorRegistry registry = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry();
+ store.setDefault(XMLUIPreferenceNames.INSERT_SINGLE_SUGGESTION, true);
store.setDefault(XMLUIPreferenceNames.AUTO_PROPOSE, true);
store.setDefault(XMLUIPreferenceNames.AUTO_PROPOSE_CODE, "<=:"); //$NON-NLS-1$
store.setDefault(XMLUIPreferenceNames.AUTO_PROPOSE_DELAY, 500);
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLUIPreferenceNames.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLUIPreferenceNames.java
index 83f1278..6c430ff 100644
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLUIPreferenceNames.java
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLUIPreferenceNames.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2010 IBM Corporation and others.
+ * Copyright (c) 2005, 2012 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
@@ -212,4 +212,12 @@
* character (<tt>\0</tt>) in the desired sort order.</p>
*/
public static final String CONTENT_ASSIST_DEFAULT_PAGE_SORT_ORDER= "xml_content_assist_default_page_sort_order"; //$NON-NLS-1$
+
+ /**
+ * <p>preference key to store the option for auto insertion of single suggestions</p>
+ * <p>
+ * Value is of type <code>boolean</code>
+ * </p>
+ */
+ public static final String INSERT_SINGLE_SUGGESTION = "insertSingleSuggestion"; //$NON-NLS-1$
}