added requirement for JRE 1.4.x or higher
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / PHPEditorEnvironment.java
index 47760a9..5243cfa 100644 (file)
@@ -12,63 +12,75 @@ Contributors:
     Klaus Hartlage - www.eclipseproject.de
 **********************************************************************/
 
-import org.eclipse.jface.text.rules.RuleBasedScanner;
+import net.sourceforge.phpdt.internal.ui.text.JavaColorManager;
+import net.sourceforge.phpdt.internal.ui.text.phpdoc.PHPDocCodeScanner;
+import net.sourceforge.phpeclipse.PHPeclipsePlugin;
+import net.sourceforge.phpeclipse.phpeditor.php.HTMLCodeScanner;
 import net.sourceforge.phpeclipse.phpeditor.php.PHPCodeScanner;
-//import net.sourceforge.phpeclipse.phpeditor.html.JavaDocScanner;
 import net.sourceforge.phpeclipse.phpeditor.util.PHPColorProvider;
 
-/** The JavaEditorEnvironment maintains singletons used by the java editor
- * examples.
+/** The PHPEditorEnvironment maintains singletons used by the php editor
  */
 public class PHPEditorEnvironment {
+ // PHPColorProvider
+  private static JavaColorManager fgColorProvider;
+  private static PHPCodeScanner fgPHPCodeScanner;
+  private static HTMLCodeScanner fgHTMLCodeScanner;
+  private static PHPDocCodeScanner fgDocScanner;
 
-       private static PHPColorProvider fgColorProvider;
-       private static PHPCodeScanner fgCodeScanner;
-       //private static JavaDocScanner fgDocScanner;
+  private static int fgRefCount = 0;
 
-       private static int fgRefCount= 0;
+  /**
+   * A connection has occured - initialize the receiver if it is the first activation.
+   */
+  public static void connect(Object client) {
+    if (++fgRefCount == 1) {
+      fgColorProvider = new JavaColorManager(); // new PHPColorProvider();
+      fgPHPCodeScanner = new PHPCodeScanner(fgColorProvider, PHPeclipsePlugin.getDefault().getPreferenceStore() );
+      fgHTMLCodeScanner = new HTMLCodeScanner(fgColorProvider, PHPeclipsePlugin.getDefault().getPreferenceStore());
+      fgDocScanner = new PHPDocCodeScanner(fgColorProvider, PHPeclipsePlugin.getDefault().getPreferenceStore() );
+    }
+  }
+
+  /**
+   * A disconnection has occured - clear the receiver if it is the last deactivation.
+   */
+  public static void disconnect(Object client) {
+    if (--fgRefCount == 0) {
+      fgPHPCodeScanner = null;
+      fgHTMLCodeScanner = null;
+      fgDocScanner = null;
+      fgColorProvider.dispose();
+      fgColorProvider = null;
+    }
+  }
+
+  /**
+   * Returns the singleton scanner.
+   */
+  public static PHPCodeScanner getPHPCodeScanner() {
+    return fgPHPCodeScanner;
+  }
+
+  /**
+   * Returns the singleton scanner.
+   */
+  public static HTMLCodeScanner getHTMLCodeScanner() {
+    return fgHTMLCodeScanner;
+  }
+
+  /**
+   * Returns the singleton PHPDoc scanner.
+   */
+  public static PHPDocCodeScanner getPHPDocCodeScanner() {
+    return fgDocScanner;
+  }
+
+  /**
+   * Returns the singleton color provider.
+   */
+  public static JavaColorManager getPHPColorProvider() {
+    return fgColorProvider;
+  }
 
-       /**
-        * A connection has occured - initialize the receiver if it is the first activation.
-        */
-       public static void connect(Object client) {
-               if (++fgRefCount == 1) {
-                       fgColorProvider= new PHPColorProvider();
-                       fgCodeScanner= new PHPCodeScanner(fgColorProvider);
-       //              fgDocScanner= new JavaDocScanner(fgColorProvider);
-               }
-       }
-       
-       /**
-        * A disconnection has occured - clear the receiver if it is the last deactivation.
-        */
-        public static void disconnect(Object client) {
-               if (--fgRefCount == 0) {
-                       fgCodeScanner= null;
-//                     fgDocScanner= null;
-                       fgColorProvider.dispose();
-                       fgColorProvider= null;
-               }
-       }
-       
-       /**
-        * Returns the singleton scanner.
-        */
-        public static RuleBasedScanner getPHPCodeScanner() {
-               return fgCodeScanner;
-       }
-       
-       /**
-        * Returns the singleton color provider.
-        */
-        public static PHPColorProvider getJavaColorProvider() {
-               return fgColorProvider;
-       }
-       
-       /**
-        * Returns the singleton document scanner.
-        */
-//      public static RuleBasedScanner getJavaDocScanner() {
-//             return fgDocScanner;
-//     }
 }