Initial Drop of JSP support
diff --git a/bundles/org.eclipse.wst.jsdt.web.support.jsp/.classpath b/bundles/org.eclipse.wst.jsdt.web.support.jsp/.classpath
new file mode 100644
index 0000000..751c8f2
--- /dev/null
+++ b/bundles/org.eclipse.wst.jsdt.web.support.jsp/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.wst.jsdt.web.support.jsp/.project b/bundles/org.eclipse.wst.jsdt.web.support.jsp/.project
new file mode 100644
index 0000000..f9e0796
--- /dev/null
+++ b/bundles/org.eclipse.wst.jsdt.web.support.jsp/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.wst.jsdt.web.support.jsp</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
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
new file mode 100644
index 0000000..3853032
--- /dev/null
+++ b/bundles/org.eclipse.wst.jsdt.web.support.jsp/META-INF/MANIFEST.MF
@@ -0,0 +1,20 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: JSDT support for JSP Plug-in
+Bundle-SymbolicName: org.eclipse.wst.jsdt.web.support.jsp;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Activator: org.eclipse.wst.jsdt.web.support.jsp.Activator
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.wst.jsdt.web.ui,
+ org.eclipse.jst.jsp.ui,
+ org.eclipse.wst.sse.ui,
+ org.eclipse.jface.text,
+ org.eclipse.jface,
+ org.eclipse.wst.html.ui,
+ org.eclipse.wst.html.core,
+ org.eclipse.jst.jsp.core,
+ org.eclipse.wst.css.core,
+ org.eclipse.wst.xml.core,
+ org.eclipse.wst.sse.core,
+ org.eclipse.wst.jsdt.web.core
+Eclipse-LazyStart: true
diff --git a/bundles/org.eclipse.wst.jsdt.web.support.jsp/build.properties b/bundles/org.eclipse.wst.jsdt.web.support.jsp/build.properties
new file mode 100644
index 0000000..e9863e2
--- /dev/null
+++ b/bundles/org.eclipse.wst.jsdt.web.support.jsp/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
diff --git a/bundles/org.eclipse.wst.jsdt.web.support.jsp/plugin.xml b/bundles/org.eclipse.wst.jsdt.web.support.jsp/plugin.xml
new file mode 100644
index 0000000..8a748e0
--- /dev/null
+++ b/bundles/org.eclipse.wst.jsdt.web.support.jsp/plugin.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+ <extension point="org.eclipse.wst.sse.ui.editorConfiguration">
+ <sourceViewerConfiguration
+ class="org.eclipse.wst.jsdt.web.support.jsp.JSDTStructuredTextViewerConfigurationJSP"
+ target="org.eclipse.jst.jsp.core.jspsource.source" />
+
+ <!--
+ <contentOutlineConfiguration
+ class="org.eclipse.jst.jsp.ui.views.contentoutline.JSPContentOutlineConfiguration"
+ target="org.eclipse.jst.jsp.core.jspsource" />
+ -->
+
+ </extension>
+
+ <extension
+ point="org.eclipse.wst.sse.ui.adapterFactoryDescription">
+ <adapterFactoryDescription
+ class="org.eclipse.wst.jsdt.web.support.jsp.JSDTAdapterFactoryProviderForJSP">
+ <contentType id="org.eclipse.jst.jsp.core.jspsource" />
+ </adapterFactoryDescription>
+ </extension>
+
+
+ <extension point="org.eclipse.wst.sse.ui.sourcevalidation">
+ <validator
+ scope="total"
+ class="org.eclipse.wst.jsdt.web.core.internal.validation.JsValidator"
+ id="org.eclipse.wst.jsdt.web.support.jsp.jssourcevalidator">
+ <contentTypeIdentifier id="org.eclipse.jst.jsp.core.jspsource">
+ <partitionType id="org.eclipse.wst.html.SCRIPT"></partitionType>
+ <partitionType id="org.eclipse.wst.html.SCRIPT.EVENT"></partitionType>
+ </contentTypeIdentifier>
+ </validator>
+ </extension>
+
+</plugin>
diff --git a/bundles/org.eclipse.wst.jsdt.web.support.jsp/src/org/eclipse/wst/jsdt/web/support/jsp/Activator.java b/bundles/org.eclipse.wst.jsdt.web.support.jsp/src/org/eclipse/wst/jsdt/web/support/jsp/Activator.java
new file mode 100644
index 0000000..0eb9dc7
--- /dev/null
+++ b/bundles/org.eclipse.wst.jsdt.web.support.jsp/src/org/eclipse/wst/jsdt/web/support/jsp/Activator.java
@@ -0,0 +1,50 @@
+package org.eclipse.wst.jsdt.web.support.jsp;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.wst.jsdt.web.support.jsp";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/bundles/org.eclipse.wst.jsdt.web.support.jsp/src/org/eclipse/wst/jsdt/web/support/jsp/JSDTAdapterFactoryProviderForJSP.java b/bundles/org.eclipse.wst.jsdt.web.support.jsp/src/org/eclipse/wst/jsdt/web/support/jsp/JSDTAdapterFactoryProviderForJSP.java
new file mode 100644
index 0000000..da995c1
--- /dev/null
+++ b/bundles/org.eclipse.wst.jsdt.web.support.jsp/src/org/eclipse/wst/jsdt/web/support/jsp/JSDTAdapterFactoryProviderForJSP.java
@@ -0,0 +1,13 @@
+package org.eclipse.wst.jsdt.web.support.jsp;
+
+import org.eclipse.jst.jsp.core.internal.modelhandler.ModelHandlerForJSP;
+import org.eclipse.wst.jsdt.web.ui.internal.registry.AdapterFactoryProviderForJSDT;
+import org.eclipse.wst.sse.core.internal.ltk.modelhandler.IDocumentTypeHandler;
+
+public class JSDTAdapterFactoryProviderForJSP extends
+ AdapterFactoryProviderForJSDT {
+
+ public boolean isFor(IDocumentTypeHandler contentTypeDescription) {
+ return (contentTypeDescription instanceof ModelHandlerForJSP);
+ }
+}
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
new file mode 100644
index 0000000..900dae0
--- /dev/null
+++ b/bundles/org.eclipse.wst.jsdt.web.support.jsp/src/org/eclipse/wst/jsdt/web/support/jsp/JSDTStructuredTextViewerConfigurationJSP.java
@@ -0,0 +1,237 @@
+package org.eclipse.wst.jsdt.web.support.jsp;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.text.IAutoEditStrategy;
+import org.eclipse.jface.text.ITextDoubleClickStrategy;
+import org.eclipse.jface.text.ITextHover;
+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.IFormattingStrategy;
+import org.eclipse.jface.text.formatter.MultiPassContentFormatter;
+import org.eclipse.jface.text.hyperlink.IHyperlinkDetector;
+import org.eclipse.jface.text.information.IInformationPresenter;
+import org.eclipse.jface.text.information.IInformationProvider;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jst.jsp.core.internal.text.StructuredTextPartitionerForJSP;
+import org.eclipse.jst.jsp.core.text.IJSPPartitions;
+import org.eclipse.jst.jsp.ui.StructuredTextViewerConfigurationJSP;
+import org.eclipse.jst.jsp.ui.internal.autoedit.StructuredAutoEditStrategyJSP;
+import org.eclipse.jst.jsp.ui.internal.format.FormattingStrategyJSPJava;
+import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
+import org.eclipse.wst.css.core.text.ICSSPartitions;
+import org.eclipse.wst.html.core.internal.format.HTMLFormatProcessorImpl;
+import org.eclipse.wst.html.core.text.IHTMLPartitions;
+import org.eclipse.wst.jsdt.web.ui.StructuredTextViewerConfigurationJSDT;
+import org.eclipse.wst.jsdt.web.ui.StructuredTextViewerConfigurationJSDT.externalTypeExtension;
+import org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration;
+import org.eclipse.wst.sse.ui.internal.ExtendedConfigurationBuilder;
+import org.eclipse.wst.sse.ui.internal.format.StructuredFormattingStrategy;
+import org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider;
+import org.eclipse.wst.xml.core.text.IXMLPartitions;
+
+public class JSDTStructuredTextViewerConfigurationJSP extends StructuredTextViewerConfigurationJSP{
+
+ private String[] fConfiguredContentTypes;
+
+ private StructuredTextViewerConfiguration fHTMLSourceViewerConfiguration;
+
+ private StructuredTextViewerConfiguration getHTMLSourceViewerConfiguration() {
+ if (fHTMLSourceViewerConfiguration == null) {
+ fHTMLSourceViewerConfiguration = new StructuredTextViewerConfigurationJSDT();
+ }
+ return fHTMLSourceViewerConfiguration;
+ }
+
+ /*
+ * From here down, had to copy code from the JSP because the class decided to make the two members above private
+ */
+ public IAutoEditStrategy[] getAutoEditStrategies(ISourceViewer sourceViewer, String contentType) {
+ IAutoEditStrategy[] strategies = null;
+
+ if (contentType == IHTMLPartitions.HTML_DEFAULT || contentType == IHTMLPartitions.HTML_DECLARATION) {
+ // html and jsp autoedit strategies
+ List allStrategies = new ArrayList(0);
+
+ // add the jsp autoedit strategy first then add all html's
+ allStrategies.add(new StructuredAutoEditStrategyJSP());
+
+ IAutoEditStrategy[] htmlStrategies = getHTMLSourceViewerConfiguration().getAutoEditStrategies(sourceViewer, contentType);
+ for (int i = 0; i < htmlStrategies.length; i++) {
+ allStrategies.add(htmlStrategies[i]);
+ }
+
+ strategies = (IAutoEditStrategy[]) allStrategies.toArray(new IAutoEditStrategy[allStrategies.size()]);
+ }
+ else {
+ strategies = super.getAutoEditStrategies(sourceViewer, contentType);
+ }
+
+ return strategies;
+ }
+
+ public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
+ if (fConfiguredContentTypes == null) {
+ /*
+ * A little bit of cheating because assuming html's configured
+ * content types will add default, unknown, and all xml configured
+ * content types
+ */
+ String[] htmlTypes = getHTMLSourceViewerConfiguration().getConfiguredContentTypes(sourceViewer);
+ String[] jspTypes = StructuredTextPartitionerForJSP.getConfiguredContentTypes();
+ fConfiguredContentTypes = new String[htmlTypes.length + jspTypes.length];
+
+ int index = 0;
+ System.arraycopy(htmlTypes, 0, fConfiguredContentTypes, index, htmlTypes.length);
+ System.arraycopy(jspTypes, 0, fConfiguredContentTypes, index += htmlTypes.length, jspTypes.length);
+ }
+
+ return fConfiguredContentTypes;
+ }
+
+ protected IContentAssistProcessor[] getContentAssistProcessors(ISourceViewer sourceViewer, String partitionType) {
+ IContentAssistProcessor[] processors = null;
+
+ if (partitionType == IHTMLPartitions.SCRIPT) {
+ // HTML JavaScript
+ IContentAssistant htmlContentAssistant = getHTMLSourceViewerConfiguration().getContentAssistant(sourceViewer);
+ IContentAssistProcessor processor = htmlContentAssistant.getContentAssistProcessor(IHTMLPartitions.SCRIPT);
+ processors = new IContentAssistProcessor[]{processor};
+ }
+ else if (partitionType == ICSSPartitions.STYLE) {
+ // HTML CSS
+ IContentAssistant htmlContentAssistant = getHTMLSourceViewerConfiguration().getContentAssistant(sourceViewer);
+ IContentAssistProcessor processor = htmlContentAssistant.getContentAssistProcessor(ICSSPartitions.STYLE);
+ processors = new IContentAssistProcessor[]{processor};
+ }
+ else{
+ processors = super.getContentAssistProcessors(sourceViewer, partitionType);
+ }
+
+ return processors;
+ }
+
+ public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
+ final IContentFormatter formatter = super.getContentFormatter(sourceViewer);
+ /*
+ * Check for any externally supported auto edit strategies from EP.
+ * [Bradley Childs - childsb@us.ibm.com]
+ */
+ String[] contentTypes = getConfiguredContentTypes(sourceViewer);
+ for (int i = 0; i < contentTypes.length; i++) {
+ IFormattingStrategy cf = (IFormattingStrategy) ExtendedConfigurationBuilder.getInstance().getConfiguration(externalTypeExtension.CONTENT_FORMATER, contentTypes[i]);
+ if (cf != null && formatter instanceof MultiPassContentFormatter) {
+ ((MultiPassContentFormatter) formatter).setSlaveStrategy(cf, contentTypes[i]);
+ }
+ }
+ return formatter;
+ }
+
+ public ITextDoubleClickStrategy getDoubleClickStrategy(ISourceViewer sourceViewer, String contentType) {
+ ITextDoubleClickStrategy strategy = null;
+
+ // html or javascript
+ if (contentType == IHTMLPartitions.HTML_DEFAULT || contentType == IHTMLPartitions.SCRIPT)
+ strategy = getHTMLSourceViewerConfiguration().getDoubleClickStrategy(sourceViewer, contentType);
+ else if (contentType == IJSPPartitions.JSP_DEFAULT)
+ // JSP (just treat like html)
+ strategy = getHTMLSourceViewerConfiguration().getDoubleClickStrategy(sourceViewer, IHTMLPartitions.HTML_DEFAULT);
+ else
+ strategy = super.getDoubleClickStrategy(sourceViewer, contentType);
+
+ return strategy;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.editors.text.TextSourceViewerConfiguration#getHyperlinkDetectors(org.eclipse.jface.text.source.ISourceViewer)
+ */
+
+ public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) {
+ if (sourceViewer == null || !fPreferenceStore.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINKS_ENABLED)) {
+ return null;
+ }
+ List allDetectors = new ArrayList(0);
+ IHyperlinkDetector[] superDetectors = super.getHyperlinkDetectors(sourceViewer);
+ for (int m = 0; m < superDetectors.length; m++) {
+ IHyperlinkDetector detector = superDetectors[m];
+ if (!allDetectors.contains(detector)) {
+ allDetectors.add(detector);
+ }
+ }
+ /* Check for external HyperLink Detectors */
+ String[] contentTypes = getConfiguredContentTypes(sourceViewer);
+ for (int i = 0; i < contentTypes.length; i++) {
+ IHyperlinkDetector hl = (IHyperlinkDetector) ExtendedConfigurationBuilder.getInstance().getConfiguration(externalTypeExtension.HYPERLINK_DETECTOR, contentTypes[i]);
+ if (hl != null) {
+ allDetectors.add(hl);
+ }
+ }
+ return (IHyperlinkDetector[]) allDetectors.toArray(new IHyperlinkDetector[0]);
+ }
+
+ public String[] getIndentPrefixes(ISourceViewer sourceViewer, String contentType) {
+ String[] indentations = null;
+
+ if (contentType == IXMLPartitions.XML_DEFAULT)
+ indentations = super.getIndentPrefixes(sourceViewer, contentType);
+ else
+ indentations = getHTMLSourceViewerConfiguration().getIndentPrefixes(sourceViewer, contentType);
+
+ return indentations;
+ }
+
+ protected IInformationProvider getInformationProvider(ISourceViewer sourceViewer, String partitionType) {
+ IInformationProvider provider = null;
+ if (partitionType == IHTMLPartitions.HTML_DEFAULT) {
+ // HTML
+ IInformationPresenter htmlPresenter = getHTMLSourceViewerConfiguration().getInformationPresenter(sourceViewer);
+ provider = htmlPresenter.getInformationProvider(IHTMLPartitions.HTML_DEFAULT);
+ }
+ else if (partitionType == IHTMLPartitions.SCRIPT) {
+ // HTML JavaScript
+ IInformationPresenter htmlPresenter = getHTMLSourceViewerConfiguration().getInformationPresenter(sourceViewer);
+ provider = htmlPresenter.getInformationProvider(IHTMLPartitions.SCRIPT);
+ }
+ else{
+ provider = super.getInformationProvider(sourceViewer, partitionType);
+ }
+ return provider;
+ }
+
+ public LineStyleProvider[] getLineStyleProviders(ISourceViewer sourceViewer, String partitionType) {
+ LineStyleProvider[] providers = null;
+
+ if (partitionType == IHTMLPartitions.HTML_DEFAULT || partitionType == IHTMLPartitions.HTML_COMMENT || partitionType == IHTMLPartitions.HTML_DECLARATION) {
+ providers = getHTMLSourceViewerConfiguration().getLineStyleProviders(sourceViewer, IHTMLPartitions.HTML_DEFAULT);
+ }
+ else if (partitionType == IHTMLPartitions.SCRIPT || partitionType == IJSPPartitions.JSP_CONTENT_JAVASCRIPT) {
+ providers = getHTMLSourceViewerConfiguration().getLineStyleProviders(sourceViewer, IHTMLPartitions.SCRIPT);
+ }
+ else if (partitionType == ICSSPartitions.STYLE) {
+ providers = getHTMLSourceViewerConfiguration().getLineStyleProviders(sourceViewer, ICSSPartitions.STYLE);
+ }
+ else{
+ providers = super.getLineStyleProviders(sourceViewer, partitionType);
+ }
+
+ return providers;
+ }
+
+ public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType, int stateMask) {
+ ITextHover hover = null;
+
+ if (contentType == IHTMLPartitions.HTML_DEFAULT || contentType == IHTMLPartitions.SCRIPT) {
+ // html and javascript regions
+ hover = getHTMLSourceViewerConfiguration().getTextHover(sourceViewer, contentType, stateMask);
+ }
+ else {
+ hover = super.getTextHover(sourceViewer, contentType);
+ }
+
+ return hover;
+ }
+}