c6cd4d2a2b485a07267e52b84bb566ab7b5f5c5c
[phpeclipse.git] /
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.Time());
82                 addVariable(new GlobalVariables.User());
83                 
84                 // compilation unit
85         /*      addVariable(new File());
86                 addVariable(new ReturnType());
87                 addVariable(new Method());
88                 addVariable(new Type());
89                 addVariable(new Package());
90                 addVariable(new Project());
91                 addVariable(new Arguments());
92
93                 // java
94                 addVariable(new Array());
95                 addVariable(new ArrayType());
96                 addVariable(new ArrayElement());
97                 addVariable(new Index());
98                 addVariable(new Iterator());
99                 addVariable(new Collection());*/
100         }
101         
102         /*
103          * @see ContextType#createContext()
104          */     
105         public TemplateContext createContext() {
106                 return new PHPUnitContext(this, fDocument, fPosition); //, fCompilationUnit);
107         }
108
109 }