Removed unuse builder from project
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / php / PHPDocumentPartitioner.java
index c408f3b..75728b9 100644 (file)
@@ -1,15 +1,15 @@
 /**********************************************************************
-Copyright (c) 2002  Widespace, OU  and others.
-All rights reserved.   This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://solareclipse.sourceforge.net/legal/cpl-v10.html
+ Copyright (c) 2002  Widespace, OU  and others.
+ All rights reserved.   This program and the accompanying materials
+ are made available under the terms of the Common Public License v1.0
+ which accompanies this distribution, and is available at
+ http://solareclipse.sourceforge.net/legal/cpl-v10.html
 
-Contributors:
-       Igor Malinin - initial contribution
+ Contributors:
+ Igor Malinin - initial contribution
 
-$Id: PHPDocumentPartitioner.java,v 1.1 2004-09-02 18:32:34 jsurfer Exp $
-**********************************************************************/
+ $Id: PHPDocumentPartitioner.java,v 1.6 2006-10-21 23:18:33 pombredanne Exp $
+ **********************************************************************/
 package net.sourceforge.phpeclipse.phpeditor.php;
 
 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
@@ -22,7 +22,6 @@ import org.eclipse.jface.text.IDocument;
 import org.eclipse.jface.text.IDocumentPartitioner;
 import org.eclipse.jface.text.rules.IPartitionTokenScanner;
 
-
 /**
  * 
  * 
@@ -30,24 +29,21 @@ import org.eclipse.jface.text.rules.IPartitionTokenScanner;
  */
 public class PHPDocumentPartitioner extends MultiViewPartitioner {
        public static final String PHP_TEMPLATE_DATA = "__php_template_data";
+
        public static final String PHP_SCRIPT_CODE = "__php_script_code";
 
-       private IPartitionTokenScanner scriptScanner;
+       public static final String[] LEGAL_TYPES = { PHP_TEMPLATE_DATA,
+                       PHP_SCRIPT_CODE };
 
-       public PHPDocumentPartitioner(
-               IPartitionTokenScanner scanner, IPartitionTokenScanner scriptScanner
-       ) {
+       public PHPDocumentPartitioner(IPartitionTokenScanner scanner) {
                super(scanner);
-
-               this.scriptScanner = scriptScanner;
        }
 
        protected FlatNode createNode(String type, int offset, int length) {
-               if (type.equals(PHPPartitionScanner.PHP_SCRIPTING_AREA) 
-               ) {
-                   if (DEBUG) {
-                     Assert.isTrue(offset>=0);
-                   }
+               if (type.equals(PHPPartitionScanner.PHP_SCRIPTING_AREA)) {
+                       if (DEBUG) {
+                               Assert.isTrue(offset >= 0);
+                       }
                        ViewNode node = new ViewNode(type);
                        node.offset = offset;
                        node.length = length;
@@ -62,20 +58,21 @@ public class PHPDocumentPartitioner extends MultiViewPartitioner {
         */
        protected IDocumentPartitioner createPartitioner(String contentType) {
                if (contentType == null) {
-//                     return JavaTextTools.createHTMLPartitioner();
+                       // return JavaTextTools.createHTMLPartitioner();
                        return PHPeclipsePlugin.getDefault().getJavaTextTools()
-                       .getXMLTextTools().createXMLPartitioner();
+                                       .getXMLTextTools().createPHPXMLPartitioner();
                }
-             
-               if (contentType.equals(PHPPartitionScanner.PHP_SCRIPTING_AREA)
-               ) {
-                       return PHPeclipsePlugin.getDefault().getJavaTextTools().createPHPPartitioner();
+
+               if (contentType.equals(PHPPartitionScanner.PHP_SCRIPTING_AREA)) {
+                       return PHPeclipsePlugin.getDefault().getJavaTextTools()
+                                       .createPHPPartitioner();
                }
                return null;
        }
 
        /*
-        * @see net.sf.solareclipse.text.rules.DocumentViewPartitioner#getContentType(String, String)
+        * @see net.sf.solareclipse.text.rules.DocumentViewPartitioner#getContentType(String,
+        *      String)
         */
        protected String getContentType(String parent, String view) {
                if (parent == null) {
@@ -90,4 +87,8 @@ public class PHPDocumentPartitioner extends MultiViewPartitioner {
 
                return super.getContentType(parent, view);
        }
-}
+
+       public String[] getLegalContentTypes() {
+               return LEGAL_TYPES;
+       }
+}
\ No newline at end of file