*** empty log message ***
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / ClassDeclaration.java
index 25fc716..bbc9775 100644 (file)
@@ -3,6 +3,7 @@ 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 java.util.ArrayList;
@@ -27,7 +28,7 @@ public class ClassDeclaration extends Statement implements OutlineableWithChildr
   public int bodyStart;
   public int bodyEnd;
   /** The methods of the class. */
-  private ArrayList methods = new ArrayList();
+  private final ArrayList methods = new ArrayList();
   /** The constructor of the class. */
   public MethodDeclaration constructor;
   /** The fields of the class. */
@@ -53,7 +54,7 @@ public class ClassDeclaration extends Statement implements OutlineableWithChildr
     this.superclass = superclass;
   }
 
-    /**
+  /**
    * Create a class giving starting and ending offset
    * @param sourceStart starting offset
    * @param sourceEnd ending offset
@@ -68,7 +69,7 @@ public class ClassDeclaration extends Statement implements OutlineableWithChildr
   }
 
   public void addMethod(MethodDeclaration method) {
-    method.add(method);
+    methods.add(method);
     children.add(method);
     if (method.name.equals(name)) {
       constructor = method;
@@ -115,12 +116,10 @@ public class ClassDeclaration extends Statement implements OutlineableWithChildr
         buff.append(";");//$NON-NLS-1$
       }
     }
-    if (methods != null) {
-      for (int i = 0; i < methods.size(); i++) {
-        MethodDeclaration o = (MethodDeclaration) methods.get(i);
-        buff.append("\n");//$NON-NLS-1$
-        buff.append(o.toString(tab + 1));
-      }
+    for (int i = 0; i < methods.size(); i++) {
+      MethodDeclaration o = (MethodDeclaration) methods.get(i);
+      buff.append("\n");//$NON-NLS-1$
+      buff.append(o.toString(tab + 1));
     }
     buff.append("\n").append(tabString(tab)).append("}"); //$NON-NLS-2$ //$NON-NLS-1$
     return buff.toString();
@@ -131,7 +130,7 @@ public class ClassDeclaration extends Statement implements OutlineableWithChildr
    * @return the header of the class
    */
   public String toStringHeader() {
-    final StringBuffer buff = new StringBuffer("class").append(name);//$NON-NLS-1$
+    final StringBuffer buff = new StringBuffer("class ").append(name);//$NON-NLS-1$
     if (superclass != null) {
       buff.append(" extends "); //$NON-NLS-1$
       buff.append(superclass);