1) Fixed html syntax highlighting.
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / ui / text / PHPSourceViewerConfiguration.java
index 6a47790..d2f345e 100644 (file)
@@ -44,7 +44,7 @@ import net.sourceforge.phpeclipse.phpeditor.php.PHPCompletionProcessor;
 import net.sourceforge.phpeclipse.phpeditor.php.PHPDocumentPartitioner;
 import net.sourceforge.phpeclipse.phpeditor.php.PHPDoubleClickSelector;
 import net.sourceforge.phpeclipse.phpeditor.php.PHPPartitionScanner;
-//import net.sourceforge.phpeclipse.xml.ui.XMLPlugin;
+import net.sourceforge.phpeclipse.xml.ui.XMLPlugin;
 import net.sourceforge.phpeclipse.xml.ui.internal.text.XMLConfiguration;
 import net.sourceforge.phpeclipse.xml.ui.internal.text.XMLPartitionScanner;
 import net.sourceforge.phpeclipse.xml.ui.text.XMLTextTools;
@@ -223,9 +223,8 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
                fPreferenceStore = preferenceStore;
                fTextEditor = editor;
                fDocumentPartitioning = partitioning;
-               // fJavaTextTools = PHPeclipsePlugin.getDefault().getJavaTextTools();
-               fXMLTextTools = new XMLTextTools(getPreferenceStore());
-               //XMLPlugin.getDefault().getXMLTextTools();
+               // fJavaTextTools = PHPeclipsePlugin.getDefault().getJavaTextTools()
+               fXMLTextTools = XMLPlugin.getDefault().getXMLTextTools();
                xmlConfiguration = new XMLConfiguration(fXMLTextTools);
                fColorManager = colorManager;
                fPreferenceStore = preferenceStore;
@@ -648,22 +647,30 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
         * (non-Javadoc) Method declared on SourceViewerConfiguration
         */
        public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
-               return new String[] { IDocument.DEFAULT_CONTENT_TYPE,
+               return new String[] { 
+                               IDocument.DEFAULT_CONTENT_TYPE,
                                PHPPartitionScanner.PHP_SCRIPTING_AREA,
 
-                               IPHPPartitions.HTML, IPHPPartitions.HTML_MULTILINE_COMMENT,
+                               IPHPPartitions.HTML, 
+                               IPHPPartitions.HTML_MULTILINE_COMMENT,
                                IPHPPartitions.PHP_PARTITIONING,
                                IPHPPartitions.PHP_SINGLELINE_COMMENT,
                                IPHPPartitions.PHP_MULTILINE_COMMENT,
                                IPHPPartitions.PHP_PHPDOC_COMMENT,
-                               IPHPPartitions.PHP_STRING_DQ, IPHPPartitions.PHP_STRING_SQ,
-                               IPHPPartitions.PHP_STRING_HEREDOC, IPHPPartitions.CSS,
+                               IPHPPartitions.PHP_STRING_DQ, 
+                               IPHPPartitions.PHP_STRING_SQ,
+                               IPHPPartitions.PHP_STRING_HEREDOC, 
+                               IPHPPartitions.CSS,
                                IPHPPartitions.CSS_MULTILINE_COMMENT,
-                               IPHPPartitions.JAVASCRIPT, IPHPPartitions.JS_MULTILINE_COMMENT,
-                               IPHPPartitions.SMARTY, IPHPPartitions.SMARTY_MULTILINE_COMMENT,
-
-                               XMLPartitionScanner.XML_PI, XMLPartitionScanner.XML_COMMENT,
-                               XMLPartitionScanner.XML_DECL, XMLPartitionScanner.XML_TAG,
+                               IPHPPartitions.JAVASCRIPT, 
+                               IPHPPartitions.JS_MULTILINE_COMMENT,
+                               IPHPPartitions.SMARTY, 
+                               IPHPPartitions.SMARTY_MULTILINE_COMMENT,
+
+                               XMLPartitionScanner.XML_PI, 
+                               XMLPartitionScanner.XML_COMMENT,
+                               XMLPartitionScanner.XML_DECL, 
+                               XMLPartitionScanner.XML_TAG,
                                XMLPartitionScanner.XML_ATTRIBUTE,
                                XMLPartitionScanner.XML_CDATA,
 
@@ -677,9 +684,12 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
        }
 
        public String[] getConfiguredHTMLContentTypes() {
-               return new String[] { XMLPartitionScanner.XML_PI,
-                               XMLPartitionScanner.XML_COMMENT, XMLPartitionScanner.XML_DECL,
-                               XMLPartitionScanner.XML_TAG, XMLPartitionScanner.XML_ATTRIBUTE,
+               return new String[] { 
+                               XMLPartitionScanner.XML_PI,
+                               XMLPartitionScanner.XML_COMMENT, 
+                               XMLPartitionScanner.XML_DECL,
+                               XMLPartitionScanner.XML_TAG, 
+                               XMLPartitionScanner.XML_ATTRIBUTE,
                                XMLPartitionScanner.XML_CDATA,
 
                                XMLPartitionScanner.DTD_INTERNAL,
@@ -689,16 +699,21 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
        }
 
        public String[] getConfiguredPHPContentTypes() {
-               return new String[] { IDocument.DEFAULT_CONTENT_TYPE,
+               return new String[] { 
+                               IDocument.DEFAULT_CONTENT_TYPE,
                                IPHPPartitions.PHP_PARTITIONING,
                                IPHPPartitions.PHP_SINGLELINE_COMMENT,
                                IPHPPartitions.PHP_MULTILINE_COMMENT,
                                IPHPPartitions.PHP_PHPDOC_COMMENT,
-                               IPHPPartitions.PHP_STRING_DQ, IPHPPartitions.PHP_STRING_SQ,
-                               IPHPPartitions.PHP_STRING_HEREDOC, IPHPPartitions.CSS,
+                               IPHPPartitions.PHP_STRING_DQ, 
+                               IPHPPartitions.PHP_STRING_SQ,
+                               IPHPPartitions.PHP_STRING_HEREDOC, 
+                               IPHPPartitions.CSS,
                                IPHPPartitions.CSS_MULTILINE_COMMENT,
-                               IPHPPartitions.JAVASCRIPT, IPHPPartitions.JS_MULTILINE_COMMENT,
-                               IPHPPartitions.SMARTY, IPHPPartitions.SMARTY_MULTILINE_COMMENT, };
+                               IPHPPartitions.JAVASCRIPT, 
+                               IPHPPartitions.JS_MULTILINE_COMMENT,
+                               IPHPPartitions.SMARTY, 
+                               IPHPPartitions.SMARTY_MULTILINE_COMMENT, };
        }
 
        /*
@@ -716,46 +731,34 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
         */
        public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
                ContentAssistant assistant = new ContentAssistant();
-               IContentAssistProcessor processor = new HTMLCompletionProcessor(
-                               getEditor());
-               assistant
-                               .setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
-               assistant.setContentAssistProcessor(processor, IPHPPartitions.HTML);
-               assistant.setContentAssistProcessor(processor,
-                               IPHPPartitions.HTML_MULTILINE_COMMENT);
-
-               assistant.setContentAssistProcessor(processor, IPHPPartitions.CSS);
-               assistant.setContentAssistProcessor(processor,
-                               IPHPPartitions.CSS_MULTILINE_COMMENT);
-               assistant.setContentAssistProcessor(processor,
-                               IPHPPartitions.JAVASCRIPT);
-               assistant.setContentAssistProcessor(processor,
-                               IPHPPartitions.JS_MULTILINE_COMMENT);
+               IContentAssistProcessor processor = new HTMLCompletionProcessor (getEditor());
+               assistant.setDocumentPartitioning (getConfiguredDocumentPartitioning(sourceViewer));
+               assistant.setContentAssistProcessor (processor, IPHPPartitions.HTML);
+               assistant.setContentAssistProcessor (processor, IPHPPartitions.HTML_MULTILINE_COMMENT);
+
+               assistant.setContentAssistProcessor (processor, IPHPPartitions.CSS);
+               assistant.setContentAssistProcessor (processor, IPHPPartitions.CSS_MULTILINE_COMMENT);
+               assistant.setContentAssistProcessor (processor, IPHPPartitions.JAVASCRIPT);
+               assistant.setContentAssistProcessor (processor, IPHPPartitions.JS_MULTILINE_COMMENT);
                // TODO define special smarty partition content assist
-               assistant.setContentAssistProcessor(processor, IPHPPartitions.SMARTY);
-               assistant.setContentAssistProcessor(processor,
-                               IPHPPartitions.SMARTY_MULTILINE_COMMENT);
+               assistant.setContentAssistProcessor (processor, IPHPPartitions.SMARTY);
+               assistant.setContentAssistProcessor (processor, IPHPPartitions.SMARTY_MULTILINE_COMMENT);
 
-               assistant.setContentAssistProcessor(processor,
-                               PHPDocumentPartitioner.PHP_TEMPLATE_DATA);
+               assistant.setContentAssistProcessor (processor, PHPDocumentPartitioner.PHP_TEMPLATE_DATA);
                String[] htmlTypes = getConfiguredHTMLContentTypes();
+               
                for (int i = 0; i < htmlTypes.length; i++) {
                        assistant.setContentAssistProcessor(processor, htmlTypes[i]);
                }
-               processor = new PHPCompletionProcessor(getEditor());
+               processor = new PHPCompletionProcessor (getEditor());
 
-               assistant.setContentAssistProcessor(processor,
-                               PHPDocumentPartitioner.PHP_SCRIPT_CODE);
-               assistant.setContentAssistProcessor(processor,
-                               IPHPPartitions.PHP_PARTITIONING);
-               assistant.setContentAssistProcessor(processor,
-                               IPHPPartitions.PHP_STRING_DQ);
-               assistant.setContentAssistProcessor(processor,
-                               IPHPPartitions.PHP_STRING_SQ);
-               assistant.setContentAssistProcessor(processor,
-                               IPHPPartitions.PHP_STRING_HEREDOC);
-
-               assistant.setContentAssistProcessor(new PHPDocCompletionProcessor(
+               assistant.setContentAssistProcessor (processor, PHPDocumentPartitioner.PHP_SCRIPT_CODE);
+               assistant.setContentAssistProcessor (processor, IPHPPartitions.PHP_PARTITIONING);
+               assistant.setContentAssistProcessor (processor, IPHPPartitions.PHP_STRING_DQ);
+               assistant.setContentAssistProcessor (processor, IPHPPartitions.PHP_STRING_SQ);
+               assistant.setContentAssistProcessor (processor, IPHPPartitions.PHP_STRING_HEREDOC);
+
+               assistant.setContentAssistProcessor (new PHPDocCompletionProcessor(
                                getEditor()), IPHPPartitions.PHP_PHPDOC_COMMENT);
                // assistant.enableAutoActivation(true);
                // assistant.setAutoActivationDelay(500);
@@ -766,11 +769,9 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
                // assistant.setContextInformationPopupBackground(
                // PHPEditorEnvironment.getPHPColorProvider().getColor(
                // new RGB(150, 150, 0)));
-               ContentAssistPreference.configure(assistant, getPreferenceStore());
-               assistant
-                               .setContextInformationPopupOrientation(ContentAssistant.CONTEXT_INFO_ABOVE);
-               assistant
-                               .setInformationControlCreator(getInformationControlCreator(sourceViewer));
+               ContentAssistPreference.configure (assistant, getPreferenceStore());
+               assistant.setContextInformationPopupOrientation (ContentAssistant.CONTEXT_INFO_ABOVE);
+               assistant.setInformationControlCreator (getInformationControlCreator(sourceViewer));
                return assistant;
        }