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 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 ...)
95 * @return the variables from outside
97 public List getOutsideVariable() {
98 return expression.getOutsideVariable();
102 * get the modified variables.
103 * @return the variables from we change value
105 public List getModifiedVariable() {
106 return expression.getModifiedVariable();
110 * Get the variables used.
111 * @return the variables used
113 public List getUsedVariable() {
114 return expression.getUsedVariable();