1) Fixed html syntax highlighting.
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / ui / text / PHPSourceViewerConfiguration.java
index f2d4ab6..d2f345e 100644 (file)
@@ -14,6 +14,7 @@ package net.sourceforge.phpdt.ui.text;
 import java.util.Vector;
 
 import net.sourceforge.phpdt.core.JavaCore;
+//import net.sourceforge.phpdt.internal.debug.ui.PHPDebugUiMessages;
 import net.sourceforge.phpdt.internal.ui.text.AbstractJavaScanner;
 import net.sourceforge.phpdt.internal.ui.text.ContentAssistPreference;
 import net.sourceforge.phpdt.internal.ui.text.HTMLTextPresenter;
@@ -222,7 +223,7 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
                fPreferenceStore = preferenceStore;
                fTextEditor = editor;
                fDocumentPartitioning = partitioning;
-               // fJavaTextTools = PHPeclipsePlugin.getDefault().getJavaTextTools();
+               // fJavaTextTools = PHPeclipsePlugin.getDefault().getJavaTextTools()
                fXMLTextTools = XMLPlugin.getDefault().getXMLTextTools();
                xmlConfiguration = new XMLConfiguration(fXMLTextTools);
                fColorManager = colorManager;
@@ -646,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,
 
@@ -675,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,
@@ -687,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, };
        }
 
        /*
@@ -714,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);
@@ -764,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;
        }
 
@@ -1016,7 +1019,10 @@ public class PHPSourceViewerConfiguration extends SourceViewerConfiguration {
                        ISourceViewer sourceViewer) {
                return new IInformationControlCreator() {
                        public IInformationControl createInformationControl(Shell parent) {
-                               return new DefaultInformationControl(parent, SWT.NONE,
+//incastrix
+                               //                              return new DefaultInformationControl(parent, SWT.NONE,
+//                                             new HTMLTextPresenter(true));
+                               return new DefaultInformationControl(parent,
                                                new HTMLTextPresenter(true));
                                // return new HoverBrowserControl(parent);
                        }