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 * A GlobalStatement statement in php.
13 * @author Matthieu Casanova
15 public class GlobalStatement extends Statement implements Outlineable {
17 /** An array of the variables called by this global statement. */
18 public AbstractVariable[] variables;
20 private Object parent;
22 private Position position;
24 public GlobalStatement(final Object parent,
25 final AbstractVariable[] variables,
26 final int sourceStart,
27 final int sourceEnd) {
28 super(sourceStart, sourceEnd);
29 this.variables = variables;
31 position = new Position(sourceStart, sourceEnd);
34 public String toString() {
35 final StringBuffer buff = new StringBuffer("global ");//$NON-NLS-1$
36 for (int i = 0; i < variables.length; i++) {
38 buff.append(", ");//$NON-NLS-1$
40 buff.append(variables[i].toStringExpression());
42 return buff.toString();
45 public String toString(final int tab) {
46 return tabString(tab) + toString();
50 * This will return the image for the outline of the object.
53 public ImageDescriptor getImage() {
54 return PHPUiImages.DESC_INC;
57 public Object getParent() {
61 public Position getPosition() {
66 * Get the variables from outside (parameters, globals ...)
67 * @return the variables from outside
69 public List getOutsideVariable() {
70 final ArrayList list = new ArrayList(variables.length);
71 for (int i = 0; i < variables.length; i++) {
72 list.addAll(variables[i].getUsedVariable());
78 * get the modified variables.
79 * @return the variables modified
81 public List getModifiedVariable() {
82 return new ArrayList(1);
86 * Get the variables used.
87 * @return the variables used
89 public List getUsedVariable() {
90 return new ArrayList(1);