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;
10 * This is a variable declaration for a php class
11 * In fact it's an array of VariableDeclaration, since a field could contains
14 * @author Matthieu Casanova
16 public class FieldDeclaration extends Statement implements Outlineable {
19 public VariableDeclaration[] vars;
21 private Object parent;
22 private Position position;
25 * @param vars the array of variables.
26 * @param sourceStart the starting offset
27 * @param sourceEnd the ending offset
29 public FieldDeclaration(VariableDeclaration[] vars, int sourceStart, int sourceEnd, Object parent) {
30 super(sourceStart, sourceEnd);
33 position = new Position(sourceStart, sourceEnd);
37 * Return the object into String.
38 * @param tab how many tabs (not used here
41 public String toString(int tab) {
42 final StringBuffer buff = new StringBuffer(tabString(tab));
43 buff.append("var ");//$NON-NLS-1$
44 for (int i = 0; i < vars.length; i++) {
45 VariableDeclaration var = vars[i];
47 buff.append(',');//$NON-NLS-1$
49 buff.append(var.toStringExpression());
51 return buff.toString();
55 * Get the image of a variable.
56 * @return the image that represents a php variable
58 public ImageDescriptor getImage() {
59 return PHPUiImages.DESC_VAR;
62 public Object getParent() {
66 public Position getPosition() {