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 91378a0..9c5bf07 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 @@ -5,8 +5,10 @@ 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; /** @@ -37,6 +39,7 @@ public class ClassDeclaration extends Statement implements OutlineableWithChildr /** The outlineable children (those will be in the node array too. */ private ArrayList children = new ArrayList(); + private Position position; /** * Create a class giving starting and ending offset * @param sourceStart starting offset @@ -51,6 +54,7 @@ public class ClassDeclaration extends Statement implements OutlineableWithChildr this.parent = parent; this.name = name; this.superclass = superclass; + position = new Position(sourceStart, name.length); } /** @@ -65,9 +69,10 @@ 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) { + public void add(MethodDeclaration method) { methods.add(method); add(method); if (method.name.equals(name)) { @@ -75,7 +80,7 @@ public class ClassDeclaration extends Statement implements OutlineableWithChildr } } - public void addVariable(FieldDeclaration var) { + public void add(FieldDeclaration var) { for (int i = 0; i < var.vars.length; i++) { VariableDeclaration c = var.vars[i]; children.add(c); @@ -83,6 +88,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 @@ -149,10 +158,6 @@ 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); } @@ -163,6 +168,19 @@ public class ClassDeclaration extends Statement implements OutlineableWithChildr } public String toString() { - return toStringHeader(); + final StringBuffer buff = new StringBuffer(new String(name));//$NON-NLS-1$ + if (superclass != null) { + buff.append(":"); //$NON-NLS-1$ + buff.append(superclass); + } + return buff.toString(); + } + + public Position getPosition() { + return position; + } + + public List getList() { + return children; } }