Author: vrubezhny
Date: 2009-06-23 09:56:25 -0400 (Tue, 23 Jun 2009)
New Revision: 16138
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JSPTextViewerConfiguration.java
Log:
JBIDE-4390: EL isn't highlighted while making OpenOn action on JSP pages.
The problem is that class org.eclipse.jst.jsp.ui.StructuredTextViewerConfigurationJSP
class is probably modified in WTP 3.1M7. So, it doesn't define the LineStyleProvider
for the partitionType == "org.eclipse.jst.jsp.SCRIPT.JSP_EL2". This breaks the
text regions styling (underlining for our case) for #{...} -like EL regions.
The workaround is performed by providing a
"org.eclipse.jst.jsp.SCRIPT.JSP_EL"-like LineStyleProvider for
"org.eclipse.jst.jsp.SCRIPT.JSP_EL2" partitions
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JSPTextViewerConfiguration.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JSPTextViewerConfiguration.java 2009-06-23
12:40:54 UTC (rev 16137)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JSPTextViewerConfiguration.java 2009-06-23
13:56:25 UTC (rev 16138)
@@ -22,9 +22,12 @@
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.jst.jsp.ui.internal.style.jspel.LineStyleProviderForJSPEL;
import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
+import org.eclipse.wst.css.core.text.ICSSPartitions;
import org.eclipse.wst.html.core.text.IHTMLPartitions;
+import org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider;
import org.eclipse.wst.xml.core.text.IXMLPartitions;
import org.osgi.framework.Bundle;
@@ -94,7 +97,50 @@
return (IContentAssistProcessor[])processors.toArray(new IContentAssistProcessor[0]);
}
+
/*
+ * JBIDE-4390:
+ * The line style provider for partition type ==
"org.eclipse.jst.jsp.SCRIPT.JSP_EL2",
+ * which is ommitted (forgotten ?) in superclass
+ */
+ private LineStyleProvider fLineStyleProviderForJSPEL2;
+
+ /*
+ * JBIDE-4390:
+ * The method is overriden to provide a line style provider for partition type ==
"org.eclipse.jst.jsp.SCRIPT.JSP_EL2",
+ * which is ommitted (forgotten ?) in superclass
+ */
+ private LineStyleProvider getLineStyleProviderForJSPEL2() {
+ if (fLineStyleProviderForJSPEL2 == null) {
+ fLineStyleProviderForJSPEL2 = new LineStyleProviderForJSPEL();
+ }
+ return fLineStyleProviderForJSPEL2;
+ }
+
+ /*
+ * JBIDE-4390:
+ * The method is overriden to provide a line style provider for partition type ==
"org.eclipse.jst.jsp.SCRIPT.JSP_EL2",
+ * which is ommitted (forgotten ?) in superclass
+ *
+ *
+ * (non-Javadoc)
+ * @see
org.eclipse.jst.jsp.ui.StructuredTextViewerConfigurationJSP#getLineStyleProviders(org.eclipse.jface.text.source.ISourceViewer,
java.lang.String)
+ */
+ public LineStyleProvider[] getLineStyleProviders(ISourceViewer sourceViewer, String
partitionType) {
+ LineStyleProvider[] providers = null;
+
+ if (partitionType == IJSPPartitions.JSP_DEFAULT_EL2) {
+ providers = new LineStyleProvider[]{getLineStyleProviderForJSPEL2()};
+ }
+ else {
+ providers = super.getLineStyleProviders(sourceViewer, partitionType);
+ }
+
+ return providers;
+ }
+
+
+ /*
* @see
org.eclipse.jface.text.source.SourceViewerConfiguration#getHyperlinkDetectors(org.eclipse.jface.text.source.ISourceViewer)
* @since 3.1
*/
Show replies by date