1 package net.sourceforge.phpdt.internal.compiler.ast;
3 import net.sourceforge.phpdt.internal.compiler.parser.Outlineable;
4 import net.sourceforge.phpdt.internal.ui.PHPUiImages;
5 import org.eclipse.jface.resource.ImageDescriptor;
6 import org.eclipse.jface.text.Position;
9 * @author Matthieu Casanova
11 public class InclusionStatement extends Statement implements Outlineable {
13 public static final int INCLUDE = 0;
14 public static final int INCLUDE_ONCE = 1;
15 public static final int REQUIRE = 2;
16 public static final int REQUIRE_ONCE = 3;
17 public boolean silent;
18 /** The kind of include. */
20 public Expression expression;
22 private Object parent;
24 private Position position;
25 public InclusionStatement(Object parent,
27 Expression expression,
29 super(sourceStart, expression.sourceEnd);
30 this.keyword = keyword;
31 this.expression = expression;
33 position = new Position(sourceStart, sourceEnd);
36 public String keywordToString() {
39 return "include"; //$NON-NLS-1$
41 return "include_once"; //$NON-NLS-1$
43 return "require"; //$NON-NLS-1$
45 return "require_once"; //$NON-NLS-1$
47 return "unknown keyword";//$NON-NLS-1$
51 * Return the object into String.
52 * @param tab how many tabs (not used here
55 public String toString(int tab) {
56 final StringBuffer buffer = new StringBuffer(tabString(tab));
57 buffer.append(toString());
58 return buffer.toString();
61 public String toString() {
62 final StringBuffer buffer = new StringBuffer();
66 buffer.append(keywordToString());
68 buffer.append(expression.toStringExpression());
69 return buffer.toString();
73 * Get the image of a variable.
74 * @return the image that represents a php variable
76 public ImageDescriptor getImage() {
77 return PHPUiImages.DESC_INC;
80 public Object getParent() {
84 public Position getPosition() {