1 package net.sourceforge.phpdt.internal.compiler.ast;
3 import net.sourceforge.phpdt.internal.compiler.parser.OutlineableWithChildren;
4 import net.sourceforge.phpdt.internal.compiler.parser.Outlineable;
5 import net.sourceforge.phpdt.internal.ui.PHPUiImages;
6 import org.eclipse.jface.resource.ImageDescriptor;
8 import java.util.ArrayList;
11 * It's a php document.
12 * It will contains html and php
13 * @author Matthieu Casanova
15 public class PHPDocument implements OutlineableWithChildren {
19 * It will include html nodes or php nodes
21 public AstNode[] nodes;
23 /** The parent of the object */
26 /** The outlineable children (those will be in the node array too. */
27 private ArrayList children = new ArrayList();
30 * Create the PHPDocument.
32 public PHPDocument(Object parent) {
37 * Return the php document as String.
38 * @return a string representation of the object.
40 public String toString() {
41 final StringBuffer buff = new StringBuffer();
44 for (i = 0; i < nodes.length; i++) {
49 buff.append(node.toString(0));
51 return buff.toString();
55 * Add an outlineable object.
56 * @param o the new outlineable
57 * @return does the addition worked ?
59 public boolean add(Outlineable o) {
60 return children.add(o);
64 * Return the outlineable at the index.
65 * @param index the index
66 * @return an outlineable object
68 public Outlineable get(int index) {
69 return (Outlineable) children.get(index);
73 * The number of outlineable children
77 return children.size();
81 * This will return the image for the outline of the object.
84 public ImageDescriptor getImage() {
85 return PHPUiImages.DESC_CLASS;
88 public Object getParent() {