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 179899 Details for
Bug 326602
Auto activation does not work in javascript regions in webpages
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch
patchFor326602P (text/plain), 9.88 KB, created by
Chris Jaun
on 2010-09-29 17:32:44 EDT
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Chris Jaun
Created:
2010-09-29 17:32:44 EDT
Size:
9.88 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.wst.jsdt.web.support.jsp >Index: src/org/eclipse/wst/jsdt/web/support/jsp/JSDTStructuredTextViewerConfigurationJSP.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.jsdt.web.support.jsp/src/org/eclipse/wst/jsdt/web/support/jsp/JSDTStructuredTextViewerConfigurationJSP.java,v >retrieving revision 1.6.2.2 >diff -u -r1.6.2.2 JSDTStructuredTextViewerConfigurationJSP.java >--- src/org/eclipse/wst/jsdt/web/support/jsp/JSDTStructuredTextViewerConfigurationJSP.java 30 Jun 2010 15:14:26 -0000 1.6.2.2 >+++ src/org/eclipse/wst/jsdt/web/support/jsp/JSDTStructuredTextViewerConfigurationJSP.java 29 Sep 2010 21:32:29 -0000 >@@ -14,11 +14,14 @@ > package org.eclipse.wst.jsdt.web.support.jsp; > > import org.eclipse.jface.text.IAutoEditStrategy; >+import org.eclipse.jface.text.contentassist.IContentAssistProcessor; > import org.eclipse.jface.text.source.ISourceViewer; > import org.eclipse.jst.jsp.core.text.IJSPPartitions; > import org.eclipse.jst.jsp.ui.StructuredTextViewerConfigurationJSP; > import org.eclipse.wst.html.core.text.IHTMLPartitions; >+import org.eclipse.wst.jsdt.web.core.text.IJsPartitions; > import org.eclipse.wst.jsdt.web.ui.StructuredTextViewerConfigurationJSDT; >+import org.eclipse.wst.jsdt.web.ui.contentassist.JSDTStructuredContentAssistProcessor; > import org.eclipse.wst.jsdt.web.ui.internal.autoedit.AutoEditStrategyForJs; > import org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration; > import org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider; >@@ -73,4 +76,32 @@ > return super.getAutoEditStrategies(sourceViewer, contentType); > } > } >+ >+ /** >+ * @see org.eclipse.jst.jsp.ui.StructuredTextViewerConfigurationJSP#getContentAssistProcessors(org.eclipse.jface.text.source.ISourceViewer, java.lang.String) >+ */ >+ protected IContentAssistProcessor[] getContentAssistProcessors( >+ ISourceViewer sourceViewer, String partitionType) { >+ >+ IContentAssistProcessor[] processors; >+ >+ if(isJavascriptPartitionType(partitionType)) { >+ IContentAssistProcessor processor = new JSDTStructuredContentAssistProcessor( >+ this.getContentAssistant(), partitionType, sourceViewer); >+ processors = new IContentAssistProcessor[]{processor}; >+ } else { >+ processors = super.getContentAssistProcessors(sourceViewer, partitionType); >+ } >+ >+ return processors; >+ } >+ >+ /** >+ * @param partitionTypeID check to see if this partition type ID is for a Javascript partition type >+ * @return <code>true</code> if the given partiton type is a Javascript partition type, >+ * <code>false</code> otherwise >+ */ >+ private static boolean isJavascriptPartitionType(String partitionTypeID) { >+ return IJsPartitions.HtmlJsPartition.equals(partitionTypeID); >+ } > } >#P org.eclipse.wst.jsdt.web.ui >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.jsdt.web.ui/META-INF/MANIFEST.MF,v >retrieving revision 1.28.2.2 >diff -u -r1.28.2.2 MANIFEST.MF >--- META-INF/MANIFEST.MF 9 Sep 2010 17:27:46 -0000 1.28.2.2 >+++ META-INF/MANIFEST.MF 29 Sep 2010 21:32:29 -0000 >@@ -7,6 +7,7 @@ > Bundle-Vendor: %Bundle-Vendor.0 > Bundle-Localization: plugin > Export-Package: org.eclipse.wst.jsdt.web.ui;x-internal:=true, >+ org.eclipse.wst.jsdt.web.ui.contentassist, > org.eclipse.wst.jsdt.web.ui.internal;x-internal:=true, > org.eclipse.wst.jsdt.web.ui.internal.autoedit;x-internal:=true, > org.eclipse.wst.jsdt.web.ui.internal.contentassist;x-internal:=true, >Index: src/org/eclipse/wst/jsdt/web/ui/StructuredTextViewerConfigurationJSDT.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/StructuredTextViewerConfigurationJSDT.java,v >retrieving revision 1.9.2.2 >diff -u -r1.9.2.2 StructuredTextViewerConfigurationJSDT.java >--- src/org/eclipse/wst/jsdt/web/ui/StructuredTextViewerConfigurationJSDT.java 30 Jun 2010 15:14:33 -0000 1.9.2.2 >+++ src/org/eclipse/wst/jsdt/web/ui/StructuredTextViewerConfigurationJSDT.java 29 Sep 2010 21:32:29 -0000 >@@ -11,9 +11,12 @@ > package org.eclipse.wst.jsdt.web.ui; > > import org.eclipse.jface.text.IAutoEditStrategy; >+import org.eclipse.jface.text.contentassist.IContentAssistProcessor; > import org.eclipse.jface.text.source.ISourceViewer; > import org.eclipse.wst.html.core.text.IHTMLPartitions; > import org.eclipse.wst.html.ui.StructuredTextViewerConfigurationHTML; >+import org.eclipse.wst.jsdt.web.core.text.IJsPartitions; >+import org.eclipse.wst.jsdt.web.ui.contentassist.JSDTStructuredContentAssistProcessor; > import org.eclipse.wst.jsdt.web.ui.internal.autoedit.AutoEditStrategyForJs; > > /** >@@ -54,4 +57,32 @@ > return super.getAutoEditStrategies(sourceViewer, contentType); > } > } >+ >+ /** >+ * @see org.eclipse.wst.html.ui.StructuredTextViewerConfigurationHTML#getContentAssistProcessors(org.eclipse.jface.text.source.ISourceViewer, java.lang.String) >+ */ >+ protected IContentAssistProcessor[] getContentAssistProcessors( >+ ISourceViewer sourceViewer, String partitionType) { >+ >+ IContentAssistProcessor[] processors; >+ >+ if(isJavascriptPartitionType(partitionType)) { >+ IContentAssistProcessor processor = new JSDTStructuredContentAssistProcessor( >+ this.getContentAssistant(), partitionType, sourceViewer); >+ processors = new IContentAssistProcessor[]{processor}; >+ } else { >+ processors = super.getContentAssistProcessors(sourceViewer, partitionType); >+ } >+ >+ return processors; >+ } >+ >+ /** >+ * @param partitionTypeID check to see if this partition type ID is for a Javascript partition type >+ * @return <code>true</code> if the given partiton type is a Javascript partition type, >+ * <code>false</code> otherwise >+ */ >+ private static boolean isJavascriptPartitionType(String partitionTypeID) { >+ return IJsPartitions.HtmlJsPartition.equals(partitionTypeID); >+ } > } >Index: src/org/eclipse/wst/jsdt/web/ui/contentassist/JSDTStructuredContentAssistProcessor.java >=================================================================== >RCS file: src/org/eclipse/wst/jsdt/web/ui/contentassist/JSDTStructuredContentAssistProcessor.java >diff -N src/org/eclipse/wst/jsdt/web/ui/contentassist/JSDTStructuredContentAssistProcessor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/wst/jsdt/web/ui/contentassist/JSDTStructuredContentAssistProcessor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,78 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 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 >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.wst.jsdt.web.ui.contentassist; >+ >+import org.eclipse.jface.preference.IPreferenceStore; >+import org.eclipse.jface.text.ITextViewer; >+import org.eclipse.jface.text.contentassist.ContentAssistant; >+import org.eclipse.jface.util.PropertyChangeEvent; >+import org.eclipse.wst.jsdt.ui.PreferenceConstants; >+import org.eclipse.wst.sse.ui.contentassist.StructuredContentAssistProcessor; >+ >+/** >+ * <p>Content assist processor for Javascript regions so that autoactivation will work in those regions.</p> >+ * >+ * <p><b>NOTE:</b> This class does not check that the given partition type is a javascript region, it just >+ * assumes it is, so the instantiator of this class must be sure they want the given partition type to be >+ * treated as if it was Javascript.</p> >+ */ >+public class JSDTStructuredContentAssistProcessor extends StructuredContentAssistProcessor { >+ /** auto activation characters */ >+ private char[] fCompletionPropoaslAutoActivationCharacters; >+ >+ /** >+ * @param assistant {@link ContentAssistant} to use >+ * @param partitionTypeID the Javascript partition type this processor is for >+ * @param viewer {@link ITextViewer} this processor is acting in >+ */ >+ public JSDTStructuredContentAssistProcessor(ContentAssistant assistant, >+ String partitionTypeID, ITextViewer viewer) { >+ super(assistant, partitionTypeID, viewer, PreferenceConstants.getPreferenceStore()); >+ >+ //get the current user preference >+ getAutoActivationCharacterPreferences(); >+ } >+ >+ /** >+ * @see org.eclipse.wst.sse.ui.contentassist.StructuredContentAssistProcessor#getCompletionProposalAutoActivationCharacters() >+ */ >+ public char[] getCompletionProposalAutoActivationCharacters() { >+ return this.fCompletionPropoaslAutoActivationCharacters; >+ } >+ >+ /** >+ * @see org.eclipse.wst.sse.ui.contentassist.StructuredContentAssistProcessor#propertyChange( >+ * org.eclipse.jface.util.PropertyChangeEvent) >+ */ >+ public void propertyChange(PropertyChangeEvent event) { >+ String property = event.getProperty(); >+ if(property.equals(PreferenceConstants.CODEASSIST_AUTOACTIVATION) || >+ property.equals(PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA)) { >+ >+ getAutoActivationCharacterPreferences(); >+ } >+ } >+ >+ /** >+ * <p>Gets the auto activation character user preferences for Javascript and stores them for later use</p> >+ */ >+ private void getAutoActivationCharacterPreferences() { >+ IPreferenceStore store = getPreferenceStore(); >+ >+ boolean doAuto = store.getBoolean(PreferenceConstants.CODEASSIST_AUTOACTIVATION); >+ if (doAuto) { >+ fCompletionPropoaslAutoActivationCharacters = >+ store.getString(PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA).toCharArray(); >+ } else { >+ fCompletionPropoaslAutoActivationCharacters = null; >+ } >+ } >+}
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
Actions:
View
|
Diff
Attachments on
bug 326602
: 179899