Author: vrubezhny
Date: 2007-07-13 12:14:23 -0400 (Fri, 13 Jul 2007)
New Revision: 2434
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/ExtendedStructuredTextViewerConfigurationJSP.java
Log:
http://jira.jboss.org/jira/browse/EXIN-330
The schema added due to allow the jsp-editor configuration to load and use custom content
assist processors dependig on the partition type.
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/ExtendedStructuredTextViewerConfigurationJSP.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/ExtendedStructuredTextViewerConfigurationJSP.java 2007-07-13
16:11:51 UTC (rev 2433)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/ExtendedStructuredTextViewerConfigurationJSP.java 2007-07-13
16:14:23 UTC (rev 2434)
@@ -29,6 +29,8 @@
import org.osgi.framework.Bundle;
import org.jboss.tools.common.model.plugin.ModelPlugin;
+import org.jboss.tools.common.text.xml.contentassist.ContentAssistProcessorBuilder;
+import org.jboss.tools.common.text.xml.contentassist.ContentAssistProcessorDefinition;
import org.jboss.tools.jst.jsp.contentassist.RedHatHtmlContentAssistProcessor;
import org.jboss.tools.jst.jsp.contentassist.RedHatJSPContentAssistProcessor;
@@ -42,15 +44,33 @@
}
protected IContentAssistProcessor[] getContentAssistProcessors(ISourceViewer
sourceViewer, String partitionType) {
- if ((partitionType == IXMLPartitions.XML_DEFAULT) || (partitionType ==
IHTMLPartitions.HTML_DEFAULT) || (partitionType == IJSPPartitions.JSP_DEFAULT) ||
(partitionType == IJSPPartitions.JSP_DIRECTIVE) || (partitionType ==
IJSPPartitions.JSP_CONTENT_DELIMITER)) {
- return new RedHatJSPContentAssistProcessor[]{new RedHatJSPContentAssistProcessor()};
+ // if we have our own processors we need
+ // to define them in plugin.xml file of their
+ // plugins using extention point
+ // "org.jboss.tools.common.text.xml.contentAssistProcessor"
+
+ ContentAssistProcessorDefinition[] defs =
ContentAssistProcessorBuilder.getInstance().getContentAssistProcessorDefinitions(partitionType);
+
+ if(defs==null) return null;
+
+ List processors = new ArrayList();
+ for(int i=0; i<defs.length; i++) {
+ IContentAssistProcessor processor = defs[i].createContentAssistProcessor();
+ if(!processors.contains(processor)) {
+ processors.add(processor);
+ }
}
- if(partitionType == IJSPPartitions.JSP_DEFAULT_EL) {
- return new RedHatJSPContentAssistProcessor[]{new RedHatJSPContentAssistProcessor()};
+
+ if ((partitionType == IXMLPartitions.XML_DEFAULT) ||
+ (partitionType == IHTMLPartitions.HTML_DEFAULT) ||
+ (partitionType == IJSPPartitions.JSP_DEFAULT) ||
+ (partitionType == IJSPPartitions.JSP_DIRECTIVE) ||
+ (partitionType == IJSPPartitions.JSP_CONTENT_DELIMITER) ||
+ (partitionType == IJSPPartitions.JSP_DEFAULT_EL) ||
+ (partitionType == IJSPPartitions.JSP_DEFAULT_EL2)) {
+ processors.add(new RedHatJSPContentAssistProcessor());
+ return (IContentAssistProcessor[])processors.toArray(new IContentAssistProcessor[0]);
}
- if(partitionType == IJSPPartitions.JSP_DEFAULT_EL2) {
- return new RedHatJSPContentAssistProcessor[]{new RedHatJSPContentAssistProcessor()};
- }
return super.getContentAssistProcessors(sourceViewer, partitionType);
}