*** empty log message ***
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / GlobalStatement.java
1 package net.sourceforge.phpdt.internal.compiler.ast;
2
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;
7
8 /**
9  * A GlobalStatement statement in php.
10  * @author Matthieu Casanova
11  */
12 public class GlobalStatement extends Statement implements Outlineable {
13
14   /** An array of the variables called by this global statement. */
15   public String[] variables;
16
17   private Object parent;
18
19   private Position position;
20
21   public GlobalStatement(Object parent, String[] variables, int sourceStart, int sourceEnd) {
22     super(sourceStart, sourceEnd);
23     this.variables = variables;
24     this.parent = parent;
25     position = new Position(sourceStart, sourceEnd);
26   }
27
28   public String toString() {
29     StringBuffer buff = new StringBuffer("global ");
30     for (int i = 0; i < variables.length; i++) {
31       if (i != 0) {
32         buff.append(", ");
33       }
34       buff.append(variables[i]);
35     }
36     return buff.toString();
37   }
38
39   public String toString(int tab) {
40     return tabString(tab) + toString();
41   }
42
43   /**
44    * This will return the image for the outline of the object.
45    * @return an image
46    */
47   public ImageDescriptor getImage() {
48     return PHPUiImages.DESC_INC;
49   }
50
51   public Object getParent() {
52     return parent;
53   }
54
55   public Position getPosition() {
56     return position;
57   }
58 }