X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ClassDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ClassDeclaration.java index 25fc716..91378a0 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ClassDeclaration.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ClassDeclaration.java @@ -3,10 +3,10 @@ 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; -import java.util.Enumeration; /** @@ -27,7 +27,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 +53,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,8 +68,8 @@ public class ClassDeclaration extends Statement implements OutlineableWithChildr } public void addMethod(MethodDeclaration method) { - method.add(method); - children.add(method); + methods.add(method); + add(method); if (method.name.equals(name)) { constructor = method; } @@ -115,12 +115,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 +129,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); @@ -160,6 +158,11 @@ public class ClassDeclaration extends Statement implements OutlineableWithChildr } public int size() { + PHPeclipsePlugin.log(1,"class size : "+children.size()); return children.size(); } + + public String toString() { + return toStringHeader(); + } }