Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 176009 Details for
Bug 306383
Need a way to configure content assist auto-activation's time
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch
306383.patch (text/plain), 31.71 KB, created by
Rakesh
on 2010-08-06 05:04:32 EDT
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Rakesh
Created:
2010-08-06 05:04:32 EDT
Size:
31.71 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jst.jsp.ui >Index: src/org/eclipse/jst/jsp/ui/StructuredTextViewerConfigurationJSP.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/StructuredTextViewerConfigurationJSP.java,v >retrieving revision 1.47 >diff -u -r1.47 StructuredTextViewerConfigurationJSP.java >--- src/org/eclipse/jst/jsp/ui/StructuredTextViewerConfigurationJSP.java 28 Jul 2010 19:42:24 -0000 1.47 >+++ src/org/eclipse/jst/jsp/ui/StructuredTextViewerConfigurationJSP.java 6 Aug 2010 07:23:29 -0000 >@@ -44,6 +44,8 @@ > import org.eclipse.wst.html.core.internal.provisional.contenttype.ContentTypeIdForHTML; > import org.eclipse.wst.html.core.text.IHTMLPartitions; > import org.eclipse.wst.html.ui.StructuredTextViewerConfigurationHTML; >+import org.eclipse.wst.html.ui.internal.HTMLUIPlugin; >+import org.eclipse.wst.html.ui.internal.preferences.HTMLUIPreferenceNames; > import org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration; > import org.eclipse.wst.sse.ui.internal.format.StructuredFormattingStrategy; > import org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider; >@@ -353,4 +355,9 @@ > //targets.put(ContentTypeIdForXML.ContentTypeID_XML, null); > return targets; > } >+ >+ protected int getContentAssistantDelay() { >+ IPreferenceStore store = HTMLUIPlugin.getDefault().getPreferenceStore();//delay is stored in html preference store >+ return store.getInt(HTMLUIPreferenceNames.AUTO_PROPOSE_DELAY); >+ } > } >Index: src/org/eclipse/jst/jsp/ui/internal/contentassist/JSPStructuredContentAssistProcessor.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/contentassist/JSPStructuredContentAssistProcessor.java,v >retrieving revision 1.3 >diff -u -r1.3 JSPStructuredContentAssistProcessor.java >--- src/org/eclipse/jst/jsp/ui/internal/contentassist/JSPStructuredContentAssistProcessor.java 3 Jun 2010 07:24:16 -0000 1.3 >+++ src/org/eclipse/jst/jsp/ui/internal/contentassist/JSPStructuredContentAssistProcessor.java 6 Aug 2010 07:23:29 -0000 >@@ -39,6 +39,9 @@ > /** property key for determining what the auto activation characters are */ > private String fAutoActivationCharactersPropertyKey; > >+ /** property key for determining what the auto activation delay is*/ >+ private String fAutoActivationDelayKey; >+ > /** the context information validator for this processor */ > private IContextInformationValidator fContextInformationValidator; > >@@ -63,6 +66,7 @@ > fAutoActivationEnabledPropertyKey = HTMLUIPreferenceNames.AUTO_PROPOSE; > fAutoActivationCharactersPropertyKey = HTMLUIPreferenceNames.AUTO_PROPOSE_CODE; > } >+ fAutoActivationDelayKey = HTMLUIPreferenceNames.AUTO_PROPOSE_DELAY; > > //get the current user preference > getAutoActivationCharacterPreferences(); >@@ -92,13 +96,27 @@ > public void propertyChange(PropertyChangeEvent event) { > String property = event.getProperty(); > if(property.equals(fAutoActivationEnabledPropertyKey) || >- property.equals(fAutoActivationCharactersPropertyKey)) { >- >+ property.equals(fAutoActivationCharactersPropertyKey)) { > getAutoActivationCharacterPreferences(); >+ }else if (property.equals(fAutoActivationDelayKey)) { >+ setAutoActivationDelay(); > } > } > > /** >+ * <p>Sets the auto activation delay in Content Assist</p> >+ */ >+ private void setAutoActivationDelay() { >+ IPreferenceStore store = getPreferenceStore(); >+ boolean doAuto = store.getBoolean(fAutoActivationEnabledPropertyKey); >+ if (doAuto) { >+ int delay = store.getInt(fAutoActivationDelayKey); >+ getContentAssistant().setAutoActivationDelay(delay); >+ } >+ >+ } >+ >+ /** > * <p>Gets the auto activation character user preferences for Java and stores them for later use</p> > */ > private void getAutoActivationCharacterPreferences() { >#P org.eclipse.wst.html.ui >Index: src/org/eclipse/wst/html/ui/StructuredTextViewerConfigurationHTML.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/StructuredTextViewerConfigurationHTML.java,v >retrieving revision 1.42 >diff -u -r1.42 StructuredTextViewerConfigurationHTML.java >--- src/org/eclipse/wst/html/ui/StructuredTextViewerConfigurationHTML.java 26 Feb 2010 20:59:38 -0000 1.42 >+++ src/org/eclipse/wst/html/ui/StructuredTextViewerConfigurationHTML.java 6 Aug 2010 07:23:36 -0000 >@@ -17,6 +17,7 @@ > > import org.eclipse.core.runtime.IPath; > import org.eclipse.core.runtime.Preferences; >+import org.eclipse.jface.preference.IPreferenceStore; > import org.eclipse.jface.text.IAutoEditStrategy; > import org.eclipse.jface.text.ITextDoubleClickStrategy; > import org.eclipse.jface.text.contentassist.IContentAssistProcessor; >@@ -32,8 +33,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; >@@ -266,4 +269,9 @@ > targets.put(ContentTypeIdForXML.ContentTypeID_XML, null); > return targets; > } >+ >+ protected int getContentAssistantDelay() { >+ IPreferenceStore store = HTMLUIPlugin.getDefault().getPreferenceStore(); >+ return store.getInt(HTMLUIPreferenceNames.AUTO_PROPOSE_DELAY); >+ } > } >\ No newline at end of file >Index: src/org/eclipse/wst/html/ui/internal/HTMLUIMessages.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/HTMLUIMessages.java,v >retrieving revision 1.20 >diff -u -r1.20 HTMLUIMessages.java >--- src/org/eclipse/wst/html/ui/internal/HTMLUIMessages.java 26 Feb 2010 20:59:37 -0000 1.20 >+++ src/org/eclipse/wst/html/ui/internal/HTMLUIMessages.java 6 Aug 2010 07:23:37 -0000 >@@ -85,6 +85,7 @@ > public static String ProjectWebContentSettingsPropertyPage_0; > > public static String Auto_Activation_UI_; >+ public static String Auto_Activation_Delay; > public static String Automatically_make_suggest_UI_; > public static String Prompt_when_these_characte_UI_; > public static String Cycling_UI_; >Index: src/org/eclipse/wst/html/ui/internal/HTMLUIPluginResources.properties >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/HTMLUIPluginResources.properties,v >retrieving revision 1.29 >diff -u -r1.29 HTMLUIPluginResources.properties >--- src/org/eclipse/wst/html/ui/internal/HTMLUIPluginResources.properties 30 Mar 2010 03:05:44 -0000 1.29 >+++ src/org/eclipse/wst/html/ui/internal/HTMLUIPluginResources.properties 6 Aug 2010 07:23:37 -0000 >@@ -50,6 +50,7 @@ > Encoding_desc=The following encoding will apply: > ## HTML Source preference page > Auto_Activation_UI_=Auto Activation >+Auto_Activation_Delay=De&lay in auto activation(ms): > Automatically_make_suggest_UI_=Automatically ma&ke suggestions > Prompt_when_these_characte_UI_=P&rompt when these characters are inserted: > Cycling_UI_=Cycling >Index: src/org/eclipse/wst/html/ui/internal/contentassist/HTMLStructuredContentAssistProcessor.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/HTMLStructuredContentAssistProcessor.java,v >retrieving revision 1.2 >diff -u -r1.2 HTMLStructuredContentAssistProcessor.java >--- src/org/eclipse/wst/html/ui/internal/contentassist/HTMLStructuredContentAssistProcessor.java 3 Jun 2010 07:05:55 -0000 1.2 >+++ src/org/eclipse/wst/html/ui/internal/contentassist/HTMLStructuredContentAssistProcessor.java 6 Aug 2010 07:23:37 -0000 >@@ -10,6 +10,7 @@ > *******************************************************************************/ > package org.eclipse.wst.html.ui.internal.contentassist; > >+import org.eclipse.jface.preference.IPreferenceStore; > import org.eclipse.jface.text.ITextViewer; > import org.eclipse.jface.text.contentassist.ContentAssistant; > import org.eclipse.jface.text.contentassist.IContextInformationValidator; >@@ -72,6 +73,22 @@ > event.getProperty().equals(HTMLUIPreferenceNames.AUTO_PROPOSE_CODE)) { > getAutoActivationCharacterPreferences(); > } >+ else if (event.getProperty().equals(HTMLUIPreferenceNames.AUTO_PROPOSE_DELAY)) { >+ setAutoActivationDelay(); >+ } >+ } >+ >+ /** >+ * <p>Sets the auto activation delay in Content Assist</p> >+ */ >+ private void setAutoActivationDelay() { >+ IPreferenceStore store = getPreferenceStore(); >+ boolean doAuto = store.getBoolean(HTMLUIPreferenceNames.AUTO_PROPOSE); >+ if (doAuto) { >+ int delay = store.getInt(HTMLUIPreferenceNames.AUTO_PROPOSE_DELAY); >+ getContentAssistant().setAutoActivationDelay(delay); >+ } >+ > } > > /** >Index: src/org/eclipse/wst/html/ui/internal/preferences/HTMLUIPreferenceInitializer.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/preferences/HTMLUIPreferenceInitializer.java,v >retrieving revision 1.15 >diff -u -r1.15 HTMLUIPreferenceInitializer.java >--- src/org/eclipse/wst/html/ui/internal/preferences/HTMLUIPreferenceInitializer.java 26 Feb 2010 20:59:37 -0000 1.15 >+++ src/org/eclipse/wst/html/ui/internal/preferences/HTMLUIPreferenceInitializer.java 6 Aug 2010 07:23:37 -0000 >@@ -38,7 +38,7 @@ > > store.setDefault(HTMLUIPreferenceNames.AUTO_PROPOSE, true); > store.setDefault(HTMLUIPreferenceNames.AUTO_PROPOSE_CODE, "<=");//$NON-NLS-1$ >- >+ store.setDefault(HTMLUIPreferenceNames.AUTO_PROPOSE_DELAY, 500); > // HTML Style Preferences > String NOBACKGROUNDBOLD = " | null | false"; //$NON-NLS-1$ > String JUSTITALIC = " | null | false | true"; //$NON-NLS-1$ >Index: src/org/eclipse/wst/html/ui/internal/preferences/HTMLUIPreferenceNames.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/preferences/HTMLUIPreferenceNames.java,v >retrieving revision 1.6 >diff -u -r1.6 HTMLUIPreferenceNames.java >--- src/org/eclipse/wst/html/ui/internal/preferences/HTMLUIPreferenceNames.java 26 Feb 2010 20:59:37 -0000 1.6 >+++ src/org/eclipse/wst/html/ui/internal/preferences/HTMLUIPreferenceNames.java 6 Aug 2010 07:23:37 -0000 >@@ -15,6 +15,19 @@ > * Preference keys for HTML UI > */ > public class HTMLUIPreferenceNames { >+ >+ /** >+ * A named preference that controls time before code assist gets auto activated. >+ * <p> >+ * Value is of type <code>String</code>. >+ * </p> >+ */ >+ public static final String AUTO_PROPOSE_DELAY = getAutoProposeDelay(); >+ >+ private static String getAutoProposeDelay() { >+ return "autoProposeDelay";//$NON-NLS-1$ >+ } >+ > /** > * A named preference that controls if code assist gets auto activated. > * <p> >Index: src/org/eclipse/wst/html/ui/internal/preferences/ui/HTMLContentAssistPreferencePage.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/preferences/ui/HTMLContentAssistPreferencePage.java,v >retrieving revision 1.1 >diff -u -r1.1 HTMLContentAssistPreferencePage.java >--- src/org/eclipse/wst/html/ui/internal/preferences/ui/HTMLContentAssistPreferencePage.java 26 Feb 2010 20:59:37 -0000 1.1 >+++ src/org/eclipse/wst/html/ui/internal/preferences/ui/HTMLContentAssistPreferencePage.java 6 Aug 2010 07:23:37 -0000 >@@ -10,7 +10,12 @@ > *******************************************************************************/ > package org.eclipse.wst.html.ui.internal.preferences.ui; > >+import java.util.regex.Matcher; >+import java.util.regex.Pattern; >+ > import org.eclipse.jface.preference.IPreferenceStore; >+import org.eclipse.swt.events.VerifyEvent; >+import org.eclipse.swt.events.VerifyListener; > import org.eclipse.swt.layout.GridData; > import org.eclipse.swt.widgets.Button; > import org.eclipse.swt.widgets.Composite; >@@ -39,8 +44,11 @@ > > // Auto Activation > private Button fAutoPropose; >+ private Label fAutoProposeDelayLabel; >+ private Text fAutoProposeDelay; > private Label fAutoProposeLabel; > private Text fAutoProposeText; >+ Pattern delayPattern = Pattern.compile("\\d{0,4}"); > > /** configuration block for changing preference having to do with the content assist categories */ > private CodeAssistCyclingConfigurationBlock fConfigurationBlock; >@@ -95,10 +103,14 @@ > protected void enableValues() { > if (fAutoPropose != null) { > if (fAutoPropose.getSelection()) { >+ fAutoProposeDelayLabel.setEnabled(true); >+ fAutoProposeDelay.setEnabled(true); > fAutoProposeLabel.setEnabled(true); > fAutoProposeText.setEnabled(true); > } > else { >+ fAutoProposeDelayLabel.setEnabled(false); >+ fAutoProposeDelay.setEnabled(false); > fAutoProposeLabel.setEnabled(false); > fAutoProposeText.setEnabled(false); > } >@@ -124,10 +136,37 @@ > ((GridData) fAutoPropose.getLayoutData()).horizontalSpan = 2; > fAutoPropose.addSelectionListener(this); > >+ fAutoProposeDelayLabel = createLabel(contentAssistGroup, HTMLUIMessages.Auto_Activation_Delay); >+ fAutoProposeDelay = createTextField(contentAssistGroup); >+ fAutoProposeDelay.addVerifyListener(new VerifyListener() { >+ >+ public void verifyText(VerifyEvent e) { >+ verifyDelay(e); >+ } >+ }); >+ > fAutoProposeLabel = createLabel(contentAssistGroup, HTMLUIMessages.Prompt_when_these_characte_UI_); > fAutoProposeText = createTextField(contentAssistGroup); > } > >+ private void verifyDelay(VerifyEvent e) { >+ StringBuffer textToVerify = new StringBuffer(); >+ textToVerify.append(fAutoProposeDelay.getText()); >+ if (e.start == e.end) { >+ textToVerify.insert(e.start, e.text); >+ } else { >+ textToVerify.replace(e.start, e.end, e.text); >+ } >+ Matcher m = delayPattern.matcher(textToVerify.toString()); >+ if (m.matches()) { >+ e.doit = true; >+ } >+ else { >+ e.doit = false; >+ } >+ >+ } >+ > /** > * <p>Create the contents for the content assist cycling preference group</p> > * @param parent {@link Composite} parent of the group >@@ -151,6 +190,13 @@ > private void storeValuesForAutoActivationGroup() { > getPreferenceStore().setValue(HTMLUIPreferenceNames.AUTO_PROPOSE, fAutoPropose.getSelection()); > getPreferenceStore().setValue(HTMLUIPreferenceNames.AUTO_PROPOSE_CODE, fAutoProposeText.getText()); >+ if (fAutoProposeDelay.getText() != "") { //$NON-NLS-1$ //Bad way to deal with empty text >+ getPreferenceStore().setValue(HTMLUIPreferenceNames.AUTO_PROPOSE_DELAY, Integer.parseInt(fAutoProposeDelay.getText())); >+ } >+ else { >+ getPreferenceStore().setValue(HTMLUIPreferenceNames.AUTO_PROPOSE_DELAY, >+ getPreferenceStore().getDefaultInt(HTMLUIPreferenceNames.AUTO_PROPOSE_DELAY)); >+ } > } > > /** >@@ -169,6 +215,7 @@ > // Content Assist > fAutoPropose.setSelection(getPreferenceStore().getBoolean(HTMLUIPreferenceNames.AUTO_PROPOSE)); > fAutoProposeText.setText(getPreferenceStore().getString(HTMLUIPreferenceNames.AUTO_PROPOSE_CODE)); >+ fAutoProposeDelay.setText((new Integer(getPreferenceStore().getInt(HTMLUIPreferenceNames.AUTO_PROPOSE_DELAY))).toString()); > } > > /** >@@ -187,6 +234,7 @@ > // Content Assist > fAutoPropose.setSelection(getPreferenceStore().getDefaultBoolean(HTMLUIPreferenceNames.AUTO_PROPOSE)); > fAutoProposeText.setText(getPreferenceStore().getDefaultString(HTMLUIPreferenceNames.AUTO_PROPOSE_CODE)); >+ fAutoProposeDelay.setText(new Integer(getPreferenceStore().getDefaultInt(HTMLUIPreferenceNames.AUTO_PROPOSE_DELAY)).toString()); > } > > /** >#P org.eclipse.wst.sse.ui >Index: src/org/eclipse/wst/sse/ui/StructuredTextViewerConfiguration.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextViewerConfiguration.java,v >retrieving revision 1.49 >diff -u -r1.49 StructuredTextViewerConfiguration.java >--- src/org/eclipse/wst/sse/ui/StructuredTextViewerConfiguration.java 5 Apr 2010 13:45:45 -0000 1.49 >+++ src/org/eclipse/wst/sse/ui/StructuredTextViewerConfiguration.java 6 Aug 2010 07:23:46 -0000 >@@ -261,8 +261,7 @@ > > // set content assist preferences > if (fPreferenceStore != null) { >- int delay = fPreferenceStore.getInt(EditorPreferenceNames.CODEASSIST_AUTOACTIVATION_DELAY); >- fContentAssistant.setAutoActivationDelay(delay); >+ fContentAssistant.setAutoActivationDelay(getContentAssistantDelay()); > > Color color = getColor(EditorPreferenceNames.CODEASSIST_PROPOSALS_BACKGROUND); > fContentAssistant.setProposalSelectorBackground(color); >@@ -713,4 +712,11 @@ > protected StructuredContentAssistant getContentAssistant() { > return this.fContentAssistant; > } >+ >+ /** >+ * @return delay associated with conten assistant >+ */ >+ protected int getContentAssistantDelay() { >+ return fPreferenceStore.getInt(EditorPreferenceNames.CODEASSIST_AUTOACTIVATION_DELAY); >+ } > } >Index: src/org/eclipse/wst/sse/ui/contentassist/StructuredContentAssistProcessor.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/contentassist/StructuredContentAssistProcessor.java,v >retrieving revision 1.8 >diff -u -r1.8 StructuredContentAssistProcessor.java >--- src/org/eclipse/wst/sse/ui/contentassist/StructuredContentAssistProcessor.java 31 Jul 2010 06:34:03 -0000 1.8 >+++ src/org/eclipse/wst/sse/ui/contentassist/StructuredContentAssistProcessor.java 6 Aug 2010 07:23:48 -0000 >@@ -909,4 +909,9 @@ > //ignore > } > } >+ >+ public ContentAssistant getContentAssistant() { >+ return fAssistant; >+ } >+ > } >#P org.eclipse.wst.xml.ui >Index: src/org/eclipse/wst/xml/ui/StructuredTextViewerConfigurationXML.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/StructuredTextViewerConfigurationXML.java,v >retrieving revision 1.44 >diff -u -r1.44 StructuredTextViewerConfigurationXML.java >--- src/org/eclipse/wst/xml/ui/StructuredTextViewerConfigurationXML.java 26 Feb 2010 20:59:33 -0000 1.44 >+++ src/org/eclipse/wst/xml/ui/StructuredTextViewerConfigurationXML.java 6 Aug 2010 07:23:50 -0000 >@@ -19,6 +19,7 @@ > > import org.eclipse.core.runtime.IPath; > import org.eclipse.core.runtime.Preferences; >+import org.eclipse.jface.preference.IPreferenceStore; > import org.eclipse.jface.text.IAutoEditStrategy; > import org.eclipse.jface.text.contentassist.IContentAssistProcessor; > import org.eclipse.jface.text.formatter.IContentFormatter; >@@ -34,9 +35,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; >@@ -223,4 +226,9 @@ > targets.put(ContentTypeIdForXML.ContentTypeID_XML, null); > return targets; > } >+ >+ protected int getContentAssistantDelay() { >+ IPreferenceStore store = XMLUIPlugin.getDefault().getPreferenceStore(); >+ return store.getInt(XMLUIPreferenceNames.AUTO_PROPOSE_DELAY); >+ } > } >Index: src/org/eclipse/wst/xml/ui/internal/XMLUIMessages.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIMessages.java,v >retrieving revision 1.38 >diff -u -r1.38 XMLUIMessages.java >--- src/org/eclipse/wst/xml/ui/internal/XMLUIMessages.java 3 Aug 2010 14:50:33 -0000 1.38 >+++ src/org/eclipse/wst/xml/ui/internal/XMLUIMessages.java 6 Aug 2010 07:23:51 -0000 >@@ -226,6 +226,7 @@ > public static String XMLContentAssistPreferencePage_Auto_Activation_UI_; > public static String XMLContentAssistPreferencePage_Cycling_UI_; > public static String Automatically_make_suggest_UI_; >+ public static String Auto_Activation_Delay; > public static String Prompt_when_these_characte_UI_; > public static String Formatting_UI_; > public static String Line_width__UI_; >Index: src/org/eclipse/wst/xml/ui/internal/XMLUIPluginResources.properties >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIPluginResources.properties,v >retrieving revision 1.47 >diff -u -r1.47 XMLUIPluginResources.properties >--- src/org/eclipse/wst/xml/ui/internal/XMLUIPluginResources.properties 3 Aug 2010 14:50:33 -0000 1.47 >+++ src/org/eclipse/wst/xml/ui/internal/XMLUIPluginResources.properties 6 Aug 2010 07:23:51 -0000 >@@ -257,6 +257,7 @@ > XMLContentAssistPreferencePage_Auto_Activation_UI_=Auto Activation > XMLContentAssistPreferencePage_Cycling_UI_=Cycling > Automatically_make_suggest_UI_=Automatically ma&ke suggestions >+Auto_Activation_Delay=De&lay in auto activation(ms): > Prompt_when_these_characte_UI_=P&rompt when these characters are inserted: > Formatting_UI_=Formatting > Line_width__UI_=Line &width: >Index: src/org/eclipse/wst/xml/ui/internal/contentassist/XMLStructuredContentAssistProcessor.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/contentassist/XMLStructuredContentAssistProcessor.java,v >retrieving revision 1.2 >diff -u -r1.2 XMLStructuredContentAssistProcessor.java >--- src/org/eclipse/wst/xml/ui/internal/contentassist/XMLStructuredContentAssistProcessor.java 3 Jun 2010 07:22:52 -0000 1.2 >+++ src/org/eclipse/wst/xml/ui/internal/contentassist/XMLStructuredContentAssistProcessor.java 6 Aug 2010 07:23:51 -0000 >@@ -12,6 +12,7 @@ > *******************************************************************************/ > package org.eclipse.wst.xml.ui.internal.contentassist; > >+import org.eclipse.jface.preference.IPreferenceStore; > import org.eclipse.jface.text.ITextViewer; > import org.eclipse.jface.text.contentassist.ContentAssistant; > import org.eclipse.jface.text.contentassist.IContextInformationValidator; >@@ -74,8 +75,25 @@ > if(event.getProperty().equals(XMLUIPreferenceNames.AUTO_PROPOSE) || > event.getProperty().equals(XMLUIPreferenceNames.AUTO_PROPOSE_CODE)) { > getAutoActivationCharacterPreferences(); >+ }else if (event.getProperty().equals(XMLUIPreferenceNames.AUTO_PROPOSE_DELAY)) { >+ setAutoActivationDelay(); > } > } >+ >+ >+ >+ /** >+ * <p>Sets the auto activation delay in Content Assist</p> >+ */ >+ private void setAutoActivationDelay() { >+ IPreferenceStore store = getPreferenceStore(); >+ boolean doAuto = store.getBoolean(XMLUIPreferenceNames.AUTO_PROPOSE); >+ if (doAuto) { >+ int delay = store.getInt(XMLUIPreferenceNames.AUTO_PROPOSE_DELAY); >+ getContentAssistant().setAutoActivationDelay(delay); >+ } >+ >+ } > > > protected void getAutoActivationCharacterPreferences() { >Index: src/org/eclipse/wst/xml/ui/internal/preferences/XMLContentAssistPreferencePage.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLContentAssistPreferencePage.java,v >retrieving revision 1.1 >diff -u -r1.1 XMLContentAssistPreferencePage.java >--- src/org/eclipse/wst/xml/ui/internal/preferences/XMLContentAssistPreferencePage.java 26 Feb 2010 20:59:33 -0000 1.1 >+++ src/org/eclipse/wst/xml/ui/internal/preferences/XMLContentAssistPreferencePage.java 6 Aug 2010 07:23:51 -0000 >@@ -11,9 +11,13 @@ > package org.eclipse.wst.xml.ui.internal.preferences; > > import java.util.Vector; >+import java.util.regex.Matcher; >+import java.util.regex.Pattern; > > import org.eclipse.jface.preference.IPreferenceStore; > import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.VerifyEvent; >+import org.eclipse.swt.events.VerifyListener; > import org.eclipse.swt.layout.GridData; > import org.eclipse.swt.widgets.Button; > import org.eclipse.swt.widgets.Combo; >@@ -42,10 +46,13 @@ > > // Auto Activation > private Button fAutoPropose; >+ private Label fAutoProposeDelayLabel; >+ private Text fAutoProposeDelay; > private Label fAutoProposeLabel; > private Text fAutoProposeText; > private Combo fSuggestionStrategyCombo; > private Vector fSuggestionStrategies = null; >+ Pattern delayPattern = Pattern.compile("\\d{0,4}"); > > /** configuration block for changing preference having to do with the content assist categories */ > private CodeAssistCyclingConfigurationBlock fConfigurationBlock; >@@ -100,10 +107,14 @@ > protected void enableValues() { > if (fAutoPropose != null) { > if (fAutoPropose.getSelection()) { >+ fAutoProposeDelayLabel.setEnabled(true); >+ fAutoProposeDelay.setEnabled(true); > fAutoProposeLabel.setEnabled(true); > fAutoProposeText.setEnabled(true); > } > else { >+ fAutoProposeDelayLabel.setEnabled(false); >+ fAutoProposeDelay.setEnabled(false); > fAutoProposeLabel.setEnabled(false); > fAutoProposeText.setEnabled(false); > } >@@ -129,6 +140,16 @@ > ((GridData) fAutoPropose.getLayoutData()).horizontalSpan = 2; > fAutoPropose.addSelectionListener(this); > >+ fAutoProposeDelayLabel = createLabel(contentAssistGroup, XMLUIMessages.Auto_Activation_Delay); >+ fAutoProposeDelay = createTextField(contentAssistGroup); >+ fAutoProposeDelay.addVerifyListener(new VerifyListener() { >+ >+ public void verifyText(VerifyEvent e) { >+ verifyDelay(e); >+ } >+ }); >+ >+ > fAutoProposeLabel = createLabel(contentAssistGroup, XMLUIMessages.Prompt_when_these_characte_UI_); > fAutoProposeText = createTextField(contentAssistGroup); > >@@ -142,6 +163,24 @@ > fSuggestionStrategies.add(XMLUIPreferenceNames.SUGGESTION_STRATEGY_VALUE_STRICT); > } > >+ private void verifyDelay(VerifyEvent e) { >+ StringBuffer textToVerify = new StringBuffer(); >+ textToVerify.append(fAutoProposeDelay.getText()); >+ if (e.start == e.end) { >+ textToVerify.insert(e.start, e.text); >+ } else { >+ textToVerify.replace(e.start, e.end, e.text); >+ } >+ Matcher m = delayPattern.matcher(textToVerify.toString()); >+ if (m.matches()) { >+ e.doit = true; >+ } >+ else { >+ e.doit = false; >+ } >+ >+ } >+ > /** > * <p>Create the contents for the content assist cycling preference group</p> > * @param parent {@link Composite} parent of the group >@@ -166,6 +205,13 @@ > getPreferenceStore().setValue(XMLUIPreferenceNames.AUTO_PROPOSE, fAutoPropose.getSelection()); > getPreferenceStore().setValue(XMLUIPreferenceNames.AUTO_PROPOSE_CODE, fAutoProposeText.getText()); > getPreferenceStore().setValue(XMLUIPreferenceNames.SUGGESTION_STRATEGY, getCurrentAutoActivationSuggestionStrategy()); >+ if (fAutoProposeDelay.getText() != "") { //$NON-NLS-1$ //Bad way to deal with empty text >+ getPreferenceStore().setValue(XMLUIPreferenceNames.AUTO_PROPOSE_DELAY, Integer.parseInt(fAutoProposeDelay.getText())); >+ } >+ else { >+ getPreferenceStore().setValue(XMLUIPreferenceNames.AUTO_PROPOSE_DELAY, >+ getPreferenceStore().getDefaultInt(XMLUIPreferenceNames.AUTO_PROPOSE_DELAY)); >+ } > } > > /** >@@ -183,6 +229,7 @@ > private void initializeValuesForAutoActivationGroup() { > fAutoPropose.setSelection(getPreferenceStore().getBoolean(XMLUIPreferenceNames.AUTO_PROPOSE)); > fAutoProposeText.setText(getPreferenceStore().getString(XMLUIPreferenceNames.AUTO_PROPOSE_CODE)); >+ fAutoProposeDelay.setText((new Integer(getPreferenceStore().getInt(XMLUIPreferenceNames.AUTO_PROPOSE_DELAY))).toString()); > String suggestionStrategy = getPreferenceStore().getString(XMLUIPreferenceNames.SUGGESTION_STRATEGY); > if (suggestionStrategy.length() > 0) { > setCurrentAutoActivationSuggestionStrategy(suggestionStrategy); >@@ -207,6 +254,7 @@ > private void performDefaultsForAutoActivationGroup() { > fAutoPropose.setSelection(getPreferenceStore().getDefaultBoolean(XMLUIPreferenceNames.AUTO_PROPOSE)); > fAutoProposeText.setText(getPreferenceStore().getDefaultString(XMLUIPreferenceNames.AUTO_PROPOSE_CODE)); >+ fAutoProposeDelay.setText(new Integer(getPreferenceStore().getDefaultInt(XMLUIPreferenceNames.AUTO_PROPOSE_DELAY)).toString()); > String suggestionStrategy = getPreferenceStore().getDefaultString(XMLUIPreferenceNames.SUGGESTION_STRATEGY); > if (suggestionStrategy.length() > 0) { > setCurrentAutoActivationSuggestionStrategy(suggestionStrategy); >Index: src/org/eclipse/wst/xml/ui/internal/preferences/XMLUIPreferenceInitializer.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLUIPreferenceInitializer.java,v >retrieving revision 1.17 >diff -u -r1.17 XMLUIPreferenceInitializer.java >--- src/org/eclipse/wst/xml/ui/internal/preferences/XMLUIPreferenceInitializer.java 26 Feb 2010 20:59:33 -0000 1.17 >+++ src/org/eclipse/wst/xml/ui/internal/preferences/XMLUIPreferenceInitializer.java 6 Aug 2010 07:23:52 -0000 >@@ -37,6 +37,7 @@ > > store.setDefault(XMLUIPreferenceNames.AUTO_PROPOSE, true); > store.setDefault(XMLUIPreferenceNames.AUTO_PROPOSE_CODE, "<=:"); //$NON-NLS-1$ >+ store.setDefault(XMLUIPreferenceNames.AUTO_PROPOSE_DELAY, 500); > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=140946 > store.setDefault(XMLUIPreferenceNames.SUGGESTION_STRATEGY, XMLUIPreferenceNames.SUGGESTION_STRATEGY_VALUE_STRICT); > store.setDefault(XMLUIPreferenceNames.USE_INFERRED_GRAMMAR, true); >Index: src/org/eclipse/wst/xml/ui/internal/preferences/XMLUIPreferenceNames.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLUIPreferenceNames.java,v >retrieving revision 1.11 >diff -u -r1.11 XMLUIPreferenceNames.java >--- src/org/eclipse/wst/xml/ui/internal/preferences/XMLUIPreferenceNames.java 26 Feb 2010 20:59:33 -0000 1.11 >+++ src/org/eclipse/wst/xml/ui/internal/preferences/XMLUIPreferenceNames.java 6 Aug 2010 07:23:52 -0000 >@@ -18,6 +18,18 @@ > > public final static String SUGGESTION_STRATEGY_VALUE_LAX = "Lax"; //$NON-NLS-1$ > public final static String SUGGESTION_STRATEGY_VALUE_STRICT = "Strict"; //$NON-NLS-1$ >+ >+ /** >+ * A named preference that controls time before code assist gets auto activated. >+ * <p> >+ * Value is of type <code>String</code>. >+ * </p> >+ */ >+ public static final String AUTO_PROPOSE_DELAY = getAutoProposeDelay(); >+ >+ private static String getAutoProposeDelay() { >+ return "autoProposeDelay";//$NON-NLS-1$ >+ } > /** > * A named preference that controls if code assist gets auto activated. > * <p>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
nsand.dev
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 306383
: 176009