608a93a7c90e427cb1c8526b2829d08ca1d377c9
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / corext / template / php / PHPContextType.java
1 /*
2  * (c) Copyright IBM Corp. 2000, 2001.
3  * All Rights Reserved.
4  */
5 package net.sourceforge.phpdt.internal.corext.template.php;
6
7 import net.sourceforge.phpdt.internal.corext.template.TemplateContext;
8
9 /**
10  * A context type for java code.
11  */
12 public class PHPContextType extends CompilationUnitContextType {
13 /*
14         protected static class Array extends TemplateVariable {
15                 public Array() {
16                         super(JavaTemplateMessages.getString("JavaContextType.variable.name.array"), JavaTemplateMessages.getString("JavaContextType.variable.description.array")); //$NON-NLS-1$ //$NON-NLS-2$
17                 }
18             public String evaluate(TemplateContext context) {
19                 return ((JavaContext) context).guessArray();
20             }
21         }
22
23         protected static class ArrayType extends TemplateVariable {
24             public ArrayType() {
25                 super(JavaTemplateMessages.getString("JavaContextType.variable.name.array.type"), JavaTemplateMessages.getString("JavaContextType.variable.description.array.type")); //$NON-NLS-1$ //$NON-NLS-2$
26             }
27             public String evaluate(TemplateContext context) {
28                 return ((JavaContext) context).guessArrayType();
29             }
30         }
31
32         protected static class ArrayElement extends TemplateVariable {
33             public ArrayElement() {
34                 super(JavaTemplateMessages.getString("JavaContextType.variable.name.array.element"), JavaTemplateMessages.getString("JavaContextType.variable.description.array.element"));     //$NON-NLS-1$ //$NON-NLS-2$    
35             }
36             public String evaluate(TemplateContext context) {
37                 return ((JavaContext) context).guessArrayElement();
38             }       
39         }
40
41         protected static class Index extends TemplateVariable {
42             public Index() {
43                 super(JavaTemplateMessages.getString("JavaContextType.variable.name.index"), JavaTemplateMessages.getString("JavaContextType.variable.description.index")); //$NON-NLS-1$ //$NON-NLS-2$
44             }
45             public String evaluate(TemplateContext context) {
46                 return ((JavaContext) context).getIndex();
47             }       
48         }
49
50         protected static class Collection extends TemplateVariable {
51             public Collection() {
52                     super(JavaTemplateMessages.getString("JavaContextType.variable.name.collection"), JavaTemplateMessages.getString("JavaContextType.variable.description.collection")); //$NON-NLS-1$ //$NON-NLS-2$
53                 }
54             public String evaluate(TemplateContext context) {
55                 return ((JavaContext) context).guessCollection();
56             }
57         }
58
59         protected static class Iterator extends TemplateVariable {
60             public Iterator() {
61                     super(JavaTemplateMessages.getString("JavaContextType.variable.name.iterator"), JavaTemplateMessages.getString("JavaContextType.variable.description.iterator")); //$NON-NLS-1$ //$NON-NLS-2$
62                 }
63             public String evaluate(TemplateContext context) {
64                 return ((JavaContext) context).getIterator();
65             }       
66         }
67
68 */      
69
70
71         /**
72          * Creates a java context type.
73          */
74         public PHPContextType() {
75                 super("php"); //$NON-NLS-1$
76                 
77                 // global
78                 addVariable(new GlobalVariables.Cursor());
79                 addVariable(new GlobalVariables.Dollar());
80                 addVariable(new GlobalVariables.Date());
81     addVariable(new GlobalVariables.Year());
82                 addVariable(new GlobalVariables.Time());
83                 addVariable(new GlobalVariables.User());
84                 
85                 // compilation unit
86         /*      addVariable(new File());
87                 addVariable(new ReturnType());
88                 addVariable(new Method());
89                 addVariable(new Type());
90                 addVariable(new Package());
91                 addVariable(new Project());
92                 addVariable(new Arguments());
93
94                 // java
95                 addVariable(new Array());
96                 addVariable(new ArrayType());
97                 addVariable(new ArrayElement());
98                 addVariable(new Index());
99                 addVariable(new Iterator());
100                 addVariable(new Collection());*/
101         }
102         
103         /*
104          * @see ContextType#createContext()
105          */     
106         public TemplateContext createContext() {
107                 return new PHPUnitContext(this, fDocument, fOffset); //, fCompilationUnit);
108         }
109
110 }