1 package net.sourceforge.phpdt.internal.compiler.ast;
3 import net.sourceforge.phpdt.internal.compiler.parser.Outlineable;
4 import net.sourceforge.phpdt.internal.compiler.ast.declarations.VariableUsage;
5 import net.sourceforge.phpdt.internal.ui.PHPUiImages;
6 import org.eclipse.jface.resource.ImageDescriptor;
7 import org.eclipse.jface.text.Position;
10 import java.util.ArrayList;
13 * A GlobalStatement statement in php.
14 * @author Matthieu Casanova
16 public class GlobalStatement extends Statement implements Outlineable {
18 /** An array of the variables called by this global statement. */
19 public String[] variables;
21 private Object parent;
23 private Position position;
25 public GlobalStatement(final Object parent,
26 final String[] variables,
27 final int sourceStart,
28 final int sourceEnd) {
29 super(sourceStart, sourceEnd);
30 this.variables = variables;
32 position = new Position(sourceStart, sourceEnd);
35 public String toString() {
36 final StringBuffer buff = new StringBuffer("global ");//$NON-NLS-1$
37 for (int i = 0; i < variables.length; i++) {
39 buff.append(", ");//$NON-NLS-1$
41 buff.append(variables[i]);
43 return buff.toString();
46 public String toString(final int tab) {
47 return tabString(tab) + toString();
51 * This will return the image for the outline of the object.
54 public ImageDescriptor getImage() {
55 return PHPUiImages.DESC_INC;
58 public Object getParent() {
62 public Position getPosition() {
67 * Get the variables from outside (parameters, globals ...)
68 * @return the variables from outside
70 public List getOutsideVariable() {
71 final ArrayList list = new ArrayList(variables.length);
72 for (int i = 0; i < variables.length; i++) {
73 list.add(new VariableUsage(variables[i],sourceStart));
79 * get the modified variables.
80 * @return the variables modified
82 public List getModifiedVariable() {
83 return new ArrayList();
87 * Get the variables used.
88 * @return the variables used
90 public List getUsedVariable() {
91 return new ArrayList();