e41fcc815e27b96eb6073c891413999d961dc805
[phpeclipse.git] /
1 /*******************************************************************************
2  * Copyright (c) 2000, 2004 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials 
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package net.sourceforge.phpdt.internal.corext.template.php;
12
13 import net.sourceforge.phpdt.core.ICompilationUnit;
14
15 import org.eclipse.jface.text.IDocument;
16 import org.eclipse.jface.text.templates.GlobalTemplateVariables;
17
18 /**
19  * A context type for javadoc.
20  */
21 public class JavaDocContextType extends CompilationUnitContextType {
22
23         public static final String NAME = "phpdoc"; //$NON-NLS-1$
24
25         /**
26          * Creates a java context type.
27          */
28         public JavaDocContextType() {
29                 super(NAME);
30
31                 // global
32                 addResolver(new GlobalTemplateVariables.Cursor());
33                 addResolver(new GlobalTemplateVariables.LineSelection());
34                 addResolver(new GlobalTemplateVariables.WordSelection());
35                 addResolver(new GlobalTemplateVariables.Dollar());
36                 addResolver(new GlobalTemplateVariables.Date());
37                 addResolver(new GlobalTemplateVariables.Year());
38                 addResolver(new GlobalTemplateVariables.Time());
39                 addResolver(new GlobalTemplateVariables.User());
40
41                 // compilation unit
42                 addResolver(new File());
43                 addResolver(new PrimaryTypeName());
44                 addResolver(new Method());
45                 addResolver(new ReturnType());
46                 addResolver(new Arguments());
47                 addResolver(new Type());
48                 addResolver(new Package());
49                 addResolver(new Project());
50         }
51
52         /*
53          * (non-Javadoc)
54          * 
55          * @see net.sourceforge.phpdt.internal.corext.template.java.CompilationUnitContextType#createContext(org.eclipse.jface.text.IDocument,
56          *      int, int, net.sourceforge.phpdt.core.ICompilationUnit)
57          */
58         public CompilationUnitContext createContext(IDocument document, int offset,
59                         int length, ICompilationUnit compilationUnit) {
60                 return new JavaDocContext(this, document, offset, length,
61                                 compilationUnit);
62         }
63
64 }