*** empty log message ***
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / ClassDeclaration.java
index 18f52c1..000afb9 100644 (file)
@@ -3,11 +3,11 @@ package net.sourceforge.phpdt.internal.compiler.ast;
 import net.sourceforge.phpdt.internal.compiler.parser.Outlineable;
 import net.sourceforge.phpdt.internal.compiler.parser.OutlineableWithChildren;
 import net.sourceforge.phpdt.internal.ui.PHPUiImages;
-import net.sourceforge.phpeclipse.PHPeclipsePlugin;
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.jface.text.Position;
 
 import java.util.ArrayList;
+import java.util.List;
 
 
 /**
@@ -68,6 +68,7 @@ public class ClassDeclaration extends Statement implements OutlineableWithChildr
     super(sourceStart, sourceEnd);
     this.parent = parent;
     this.name = name;
+    position = new Position(sourceStart, name.length);
   }
 
   public void addMethod(MethodDeclaration method) {
@@ -78,7 +79,7 @@ public class ClassDeclaration extends Statement implements OutlineableWithChildr
     }
   }
 
-  public void addVariable(FieldDeclaration var) {
+  public void addField(FieldDeclaration var) {
     for (int i = 0; i < var.vars.length; i++) {
       VariableDeclaration c = var.vars[i];
       children.add(c);
@@ -86,6 +87,10 @@ public class ClassDeclaration extends Statement implements OutlineableWithChildr
     fields.add(var);
   }
 
+  public boolean add(Outlineable o) {
+    return children.add(o);
+  }
+
   /**
    * Tell if the class has a constructor.
    * @return a boolean
@@ -104,7 +109,7 @@ public class ClassDeclaration extends Statement implements OutlineableWithChildr
   }
 
   /**
-   * Return the body of the class as String
+   * Return the body of the class as String.
    * @param tab how many tabs before the body of the class
    * @return the body as String
    */
@@ -152,24 +157,28 @@ public class ClassDeclaration extends Statement implements OutlineableWithChildr
     return parent;
   }
 
-  public boolean add(Outlineable o) {
-    return children.add(o);
-  }
-
   public Outlineable get(int index) {
     return (Outlineable) children.get(index);
   }
 
   public int size() {
-    PHPeclipsePlugin.log(1,"class size : "+children.size());
     return children.size();
   }
 
   public String toString() {
-    return toStringHeader();
+    final StringBuffer buff = new StringBuffer(new String(name));
+    if (superclass != null) {
+      buff.append(":"); //$NON-NLS-1$
+      buff.append(superclass);
+    }
+    return buff.toString();
   }
 
   public Position getPosition() {
     return position;
   }
+
+  public List getList() {
+    return children;
+  }
 }