Defined a limit for code completion list entries PHPeclipsePlugin.MAX_PROPOSALS
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / ui / text / JavaTextTools.java
index b3073f1..e920473 100644 (file)
@@ -8,6 +8,8 @@ package net.sourceforge.phpdt.ui.text;
 import net.sourceforge.phpdt.internal.ui.text.FastJavaPartitionScanner;
 import net.sourceforge.phpdt.internal.ui.text.JavaColorManager;
 import net.sourceforge.phpdt.internal.ui.text.phpdoc.PHPDocCodeScanner;
+import net.sourceforge.phpeclipse.IPreferenceConstants;
+import net.sourceforge.phpeclipse.phpeditor.php.HTMLCodeScanner;
 import net.sourceforge.phpeclipse.phpeditor.php.PHPCodeScanner;
 
 import org.eclipse.jface.preference.IPreferenceStore;
@@ -45,16 +47,18 @@ public class JavaTextTools {
                
        /** The color manager */
        private JavaColorManager fColorManager;
-       /** The Java source code scanner */
+       /** The PHP source code scanner */
        private PHPCodeScanner fCodeScanner;
-       /** The Java multiline comment scanner */
+       /** The PHP multiline comment scanner */
        private SingleTokenPHPScanner fMultilineCommentScanner;
        /** The Java singleline comment scanner */
        private SingleTokenPHPScanner fSinglelineCommentScanner;
        /** The Java string scanner */
        private SingleTokenPHPScanner fStringScanner;
-       /** The JavaDoc scanner */
+       /** The PHPDoc scanner */
        private PHPDocCodeScanner fJavaDocScanner;
+  /** The HTML scanner */
+  private HTMLCodeScanner fHTMLScanner;
        /** The Java partitions scanner */
        private FastJavaPartitionScanner fPartitionScanner;     
        
@@ -81,10 +85,11 @@ public class JavaTextTools {
                
                fColorManager= new JavaColorManager();
                fCodeScanner= new PHPCodeScanner(fColorManager, store);
-               fMultilineCommentScanner= new SingleTokenPHPScanner(fColorManager, store, IJavaColorConstants.JAVA_MULTI_LINE_COMMENT);
-               fSinglelineCommentScanner= new SingleTokenPHPScanner(fColorManager, store, IJavaColorConstants.JAVA_SINGLE_LINE_COMMENT);
-               fStringScanner= new SingleTokenPHPScanner(fColorManager, store, IJavaColorConstants.JAVA_STRING);
+               fMultilineCommentScanner= new SingleTokenPHPScanner(fColorManager, store, IPreferenceConstants.PHP_MULTILINE_COMMENT);
+               fSinglelineCommentScanner= new SingleTokenPHPScanner(fColorManager, store, IPreferenceConstants.PHP_SINGLELINE_COMMENT);
+               fStringScanner= new SingleTokenPHPScanner(fColorManager, store, IPreferenceConstants.PHP_STRING);
                fJavaDocScanner= new PHPDocCodeScanner(fColorManager, store);
+    fHTMLScanner= new HTMLCodeScanner(fColorManager, store);
                fPartitionScanner= new FastJavaPartitionScanner();
        }
        
@@ -142,6 +147,17 @@ public class JavaTextTools {
                return fMultilineCommentScanner;
        }
 
+  /**
+   * Returns a scanner which is configured to scan HTML code.
+   *
+   * @return a HTML scanner
+   * 
+   * @since 2.0
+   */
+  public RuleBasedScanner getHTMLScanner() {
+    return fHTMLScanner;
+  } 
+  
        /**
         * Returns a scanner which is configured to scan Java singleline comments.
         *
@@ -228,11 +244,11 @@ public class JavaTextTools {
         * @since 2.0
         */
        public boolean affectsBehavior(PropertyChangeEvent event) {
-               return // fCodeScanner.affectsBehavior(event) ||
+               return fCodeScanner.affectsBehavior(event) ||
                                        fMultilineCommentScanner.affectsBehavior(event) ||
                                        fSinglelineCommentScanner.affectsBehavior(event) ||
-                                       fStringScanner.affectsBehavior(event); // ||
-//                                     fJavaDocScanner.affectsBehavior(event);
+                                       fStringScanner.affectsBehavior(event) ||
+                                       fJavaDocScanner.affectsBehavior(event);
        }
        
        /**
@@ -243,15 +259,15 @@ public class JavaTextTools {
         * @since 2.0
         */
        protected void adaptToPreferenceChange(PropertyChangeEvent event) {
-//             if (fCodeScanner.affectsBehavior(event))
-//                     fCodeScanner.adaptToPreferenceChange(event);
+               if (fCodeScanner.affectsBehavior(event))
+                       fCodeScanner.adaptToPreferenceChange(event);
                if (fMultilineCommentScanner.affectsBehavior(event))
                        fMultilineCommentScanner.adaptToPreferenceChange(event);
                if (fSinglelineCommentScanner.affectsBehavior(event))
                        fSinglelineCommentScanner.adaptToPreferenceChange(event);
                if (fStringScanner.affectsBehavior(event))
                        fStringScanner.adaptToPreferenceChange(event);
-//             if (fJavaDocScanner.affectsBehavior(event))
-//                     fJavaDocScanner.adaptToPreferenceChange(event);
+               if (fJavaDocScanner.affectsBehavior(event))
+                       fJavaDocScanner.adaptToPreferenceChange(event);
        }
 }
\ No newline at end of file