1 package net.sourceforge.phpeclipse.phpeditor;
3 /**********************************************************************
4 Copyright (c) 2000, 2002 IBM Corp. and others.
5 All rights reserved. This program and the accompanying materials
6 are made available under the terms of the Common Public License v1.0
7 which accompanies this distribution, and is available at
8 http://www.eclipse.org/legal/cpl-v10.html
11 IBM Corporation - Initial implementation
12 Klaus Hartlage - www.eclipseproject.de
13 **********************************************************************/
15 import org.eclipse.jface.text.rules.RuleBasedScanner;
16 import net.sourceforge.phpeclipse.phpeditor.php.PHPCodeScanner;
17 //import net.sourceforge.phpeclipse.phpeditor.html.JavaDocScanner;
18 import net.sourceforge.phpeclipse.phpeditor.util.PHPColorProvider;
20 /** The JavaEditorEnvironment maintains singletons used by the java editor
23 public class PHPEditorEnvironment {
25 private static PHPColorProvider fgColorProvider;
26 private static PHPCodeScanner fgCodeScanner;
27 //private static JavaDocScanner fgDocScanner;
29 private static int fgRefCount= 0;
32 * A connection has occured - initialize the receiver if it is the first activation.
34 public static void connect(Object client) {
35 if (++fgRefCount == 1) {
36 fgColorProvider= new PHPColorProvider();
37 fgCodeScanner= new PHPCodeScanner(fgColorProvider);
38 // fgDocScanner= new JavaDocScanner(fgColorProvider);
43 * A disconnection has occured - clear the receiver if it is the last deactivation.
45 public static void disconnect(Object client) {
46 if (--fgRefCount == 0) {
48 // fgDocScanner= null;
49 fgColorProvider.dispose();
50 fgColorProvider= null;
55 * Returns the singleton scanner.
57 public static RuleBasedScanner getPHPCodeScanner() {
62 * Returns the singleton color provider.
64 public static PHPColorProvider getJavaColorProvider() {
65 return fgColorProvider;
69 * Returns the singleton document scanner.
71 // public static RuleBasedScanner getJavaDocScanner() {
72 // return fgDocScanner;