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 fa460f5..74a6c11 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 @@ -1,11 +1,14 @@ package net.sourceforge.phpdt.internal.compiler.ast; -import net.sourceforge.phpdt.internal.compiler.parser.OutlineableWithChildren; +import java.util.ArrayList; +import java.util.List; + import net.sourceforge.phpdt.internal.compiler.parser.Outlineable; +import net.sourceforge.phpdt.internal.compiler.parser.OutlineableWithChildren; import net.sourceforge.phpdt.internal.ui.PHPUiImages; -import org.eclipse.jface.resource.ImageDescriptor; -import java.util.ArrayList; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.text.Position; /** * It's a php document. @@ -21,18 +24,24 @@ public class PHPDocument implements OutlineableWithChildren { */ public AstNode[] nodes; + 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(final Object parent, + final char[] name) { this.parent = parent; + this.name = name; + position = new Position(1,name.length); } /** @@ -50,6 +59,11 @@ public class PHPDocument implements OutlineableWithChildren { break; } buff.append(node.toString(0)); + if (node instanceof HTMLCode) { + buff.append("\n");//$NON-NLS-1$ + } else { + buff.append(";\n");//$NON-NLS-1$ + } } } return buff.toString(); @@ -60,7 +74,7 @@ public class PHPDocument implements OutlineableWithChildren { * @param o the new outlineable * @return does the addition worked ? */ - public boolean add(Outlineable o) { + public boolean add(final Outlineable o) { return children.add(o); } @@ -69,7 +83,7 @@ public class PHPDocument implements OutlineableWithChildren { * @param index the index * @return an outlineable object */ - public Outlineable get(int index) { + public Outlineable get(final int index) { return (Outlineable) children.get(index); } @@ -96,4 +110,12 @@ public class PHPDocument implements OutlineableWithChildren { public Object getParent() { return parent; } + + public Position getPosition() { + return position; + } + + public List getList() { + return children; + } } \ No newline at end of file