1 package net.sourceforge.phpdt.internal.compiler.ast;
5 import net.sourceforge.phpdt.internal.compiler.parser.Outlineable;
6 import net.sourceforge.phpdt.internal.ui.PHPUiImages;
8 import org.eclipse.jface.resource.ImageDescriptor;
9 import org.eclipse.jface.text.Position;
12 * @author Matthieu Casanova
14 public class InclusionStatement extends Statement implements Outlineable {
16 public static final int INCLUDE = 0;
17 public static final int INCLUDE_ONCE = 1;
18 public static final int REQUIRE = 2;
19 public static final int REQUIRE_ONCE = 3;
20 public boolean silent;
21 /** The kind of include. */
23 public Expression expression;
25 private Object parent;
27 private Position position;
29 public InclusionStatement(final Object parent,
31 final Expression expression,
32 final int sourceStart,
33 final int sourceEnd) {
34 super(sourceStart, sourceEnd);
35 this.keyword = keyword;
36 this.expression = expression;
38 position = new Position(sourceStart, sourceEnd);
41 public String keywordToString() {
44 return "include"; //$NON-NLS-1$
46 return "include_once"; //$NON-NLS-1$
48 return "require"; //$NON-NLS-1$
50 return "require_once"; //$NON-NLS-1$
52 return "unknown keyword";//$NON-NLS-1$
56 * Return the object into String.
57 * @param tab how many tabs (not used here
60 public String toString(final int tab) {
61 final StringBuffer buffer = new StringBuffer(tabString(tab));
62 buffer.append(toString());
63 return buffer.toString();
66 public String toString() {
67 final StringBuffer buffer = new StringBuffer();
71 buffer.append(keywordToString());
73 buffer.append(expression.toStringExpression());
74 return buffer.toString();
78 * Get the image of a variable.
79 * @return the image that represents a php variable
81 public ImageDescriptor getImage() {
82 return PHPUiImages.DESC_INC;
85 public Object getParent() {
89 public Position getPosition() {
94 * Get the variables from outside (parameters, globals ...)
96 public void getOutsideVariable(final List list) {
97 expression.getOutsideVariable(list);
101 * get the modified variables.
103 public void getModifiedVariable(final List list) {
104 expression.getModifiedVariable(list);
108 * Get the variables used.
110 public void getUsedVariable(final List list) {
111 expression.getUsedVariable(list);