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 import java.util.ArrayList;
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 super(sourceStart, expression.sourceEnd);
34 this.keyword = keyword;
35 this.expression = expression;
37 position = new Position(sourceStart, sourceEnd);
40 public String keywordToString() {
43 return "include"; //$NON-NLS-1$
45 return "include_once"; //$NON-NLS-1$
47 return "require"; //$NON-NLS-1$
49 return "require_once"; //$NON-NLS-1$
51 return "unknown keyword";//$NON-NLS-1$
55 * Return the object into String.
56 * @param tab how many tabs (not used here
59 public String toString(final int tab) {
60 final StringBuffer buffer = new StringBuffer(tabString(tab));
61 buffer.append(toString());
62 return buffer.toString();
65 public String toString() {
66 final StringBuffer buffer = new StringBuffer();
70 buffer.append(keywordToString());
72 buffer.append(expression.toStringExpression());
73 return buffer.toString();
77 * Get the image of a variable.
78 * @return the image that represents a php variable
80 public ImageDescriptor getImage() {
81 return PHPUiImages.DESC_INC;
84 public Object getParent() {
88 public Position getPosition() {
93 * Get the variables from outside (parameters, globals ...)
94 * @return the variables from outside
96 public List getOutsideVariable() {
97 return expression.getOutsideVariable();
101 * get the modified variables.
102 * @return the variables from we change value
104 public List getModifiedVariable() {
105 return expression.getModifiedVariable();
109 * Get the variables used.
110 * @return the variables used
112 public List getUsedVariable() {
113 return expression.getUsedVariable();