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