Rewritten Parser/Scanner to package net.sourceforge.phpdt.internal.compiler.parser
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / phpparser / PHPReqIncDeclaration.java
1 package net.sourceforge.phpeclipse.phpeditor.phpparser;
2
3 import net.sourceforge.phpdt.internal.ui.PHPUiImages;
4
5 import org.eclipse.jface.resource.ImageDescriptor;
6
7 /**
8  * A require, require_once, include or include_once declaration strongly inspired by the PHPFunctionDeclaration of Khartlage (:.
9  * @author khartlage, Matthieu Casanova
10  */
11 public class PHPReqIncDeclaration extends PHPSegment {
12
13   /** What is required/included. */
14   private String value;
15     /**
16      * Create an include declaration.
17      * @param parent the parent object (it should be a php class or function)
18      * @param name it should be require, require_once, include or include_once
19      * @param index where the keyword is in the file
20      * @param value what is included
21      */
22     public PHPReqIncDeclaration(Object parent, String name, int index, String value) {
23       super(parent, name, index);
24       this.value = value;
25     }
26
27   /**
28    * Create an include declaration.
29    * @param parent the parent object (it should be a php class or function)
30    * @param name it should be require, require_once, include or include_once
31    * @param index where the keyword is in the file
32    */
33   public PHPReqIncDeclaration(Object parent, String name, int index) {
34       this(parent, name, index,null);
35   }
36
37     /**
38      * Get the image of a variable.
39      * @return the image that represents a php variable
40      */
41     public ImageDescriptor getImage() {
42         return PHPUiImages.DESC_INC;
43     }
44
45   public String toString() {
46     return name + " : " + value;
47   }
48 }