[326602] Auto activation does not work in javascript regions in webpages
diff --git a/bundles/org.eclipse.wst.jsdt.web.support.jsp/META-INF/MANIFEST.MF b/bundles/org.eclipse.wst.jsdt.web.support.jsp/META-INF/MANIFEST.MF index 4f552a3..396d117 100644 --- a/bundles/org.eclipse.wst.jsdt.web.support.jsp/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.wst.jsdt.web.support.jsp/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name.0 Bundle-SymbolicName: org.eclipse.wst.jsdt.web.support.jsp;singleton:=true -Bundle-Version: 1.0.301.qualifier +Bundle-Version: 1.0.302.qualifier Bundle-Activator: org.eclipse.wst.jsdt.web.support.jsp.Activator Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)", org.eclipse.wst.jsdt.web.ui;bundle-version="[1.0.200,2.0.0)",
diff --git a/bundles/org.eclipse.wst.jsdt.web.support.jsp/src/org/eclipse/wst/jsdt/web/support/jsp/JSDTStructuredTextViewerConfigurationJSP.java b/bundles/org.eclipse.wst.jsdt.web.support.jsp/src/org/eclipse/wst/jsdt/web/support/jsp/JSDTStructuredTextViewerConfigurationJSP.java index 661e60d..1d4d3c4 100644 --- a/bundles/org.eclipse.wst.jsdt.web.support.jsp/src/org/eclipse/wst/jsdt/web/support/jsp/JSDTStructuredTextViewerConfigurationJSP.java +++ b/bundles/org.eclipse.wst.jsdt.web.support.jsp/src/org/eclipse/wst/jsdt/web/support/jsp/JSDTStructuredTextViewerConfigurationJSP.java
@@ -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); + } }