X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/PHPDocument.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/PHPDocument.java index e3bc4c5..e2d2fc5 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/PHPDocument.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/PHPDocument.java @@ -4,11 +4,14 @@ import net.sourceforge.phpdt.internal.compiler.parser.OutlineableWithChildren; import net.sourceforge.phpdt.internal.compiler.parser.Outlineable; import net.sourceforge.phpdt.internal.ui.PHPUiImages; import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.text.Position; import java.util.ArrayList; +import java.util.List; /** * It's a php document. + * This class is an outlineable object * It will contains html and php * @author Matthieu Casanova */ @@ -20,17 +23,22 @@ public class PHPDocument implements OutlineableWithChildren { */ public AstNode[] nodes; - /** The parent of the object */ + public char[] name; + /** The parent of the object. */ public Object parent; /** The outlineable children (those will be in the node array too. */ private ArrayList children = new ArrayList(); + private Position position; /** * Create the PHPDocument. + * @param parent the parent object (it should be null isn't it ?) */ - public PHPDocument(Object parent) { + public PHPDocument(Object parent, char[] name) { this.parent = parent; + this.name = name; + position = new Position(1,name.length); } /** @@ -40,13 +48,16 @@ public class PHPDocument implements OutlineableWithChildren { public String toString() { final StringBuffer buff = new StringBuffer(); AstNode node; - int i; - for (i = 0; i < nodes.length; i++) { - node = nodes[i]; - if (node == null) { - break; + if (nodes != null) { + int i; + for (i = 0; i < nodes.length; i++) { + node = nodes[i]; + if (node == null) { + break; + } + buff.append(node.toString(0)); + buff.append(";\n"); } - buff.append(node.toString(0)); } return buff.toString(); } @@ -70,8 +81,8 @@ public class PHPDocument implements OutlineableWithChildren { } /** - * The number of outlineable children - * @return + * The number of outlineable children. + * @return the number of children that are outlineable */ public int size() { return children.size(); @@ -85,7 +96,19 @@ public class PHPDocument implements OutlineableWithChildren { return PHPUiImages.DESC_CLASS; } + /** + * Get the parent of the object. + * @return the parent of the object + */ public Object getParent() { return parent; } + + public Position getPosition() { + return position; + } + + public List getList() { + return children; + } } \ No newline at end of file