4882d95ba353478fb8d02d6d376f7ffd65af5732
[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 org.eclipse.jface.text.IDocument;
14 import org.eclipse.jface.text.templates.*;
15
16 import net.sourceforge.phpdt.core.ICompilationUnit;
17
18
19 /**
20  * A context type for javadoc.
21  */
22 public class JavaDocContextType extends CompilationUnitContextType {
23
24         public static final String NAME= "phpdoc"; //$NON-NLS-1$
25
26         /**
27          * Creates a java context type.
28          */
29         public JavaDocContextType() {
30                 super(NAME);
31                 
32                 // global
33                 addResolver(new GlobalTemplateVariables.Cursor());
34                 addResolver(new GlobalTemplateVariables.LineSelection());
35                 addResolver(new GlobalTemplateVariables.WordSelection());
36                 addResolver(new GlobalTemplateVariables.Dollar());
37                 addResolver(new GlobalTemplateVariables.Date());
38                 addResolver(new GlobalTemplateVariables.Year());
39                 addResolver(new GlobalTemplateVariables.Time());
40                 addResolver(new GlobalTemplateVariables.User());
41                 
42                 // compilation unit
43                 addResolver(new File());
44                 addResolver(new PrimaryTypeName());
45                 addResolver(new Method());
46                 addResolver(new ReturnType());
47                 addResolver(new Arguments());
48                 addResolver(new Type());
49                 addResolver(new Package());
50                 addResolver(new Project());
51         }
52         
53         /* (non-Javadoc)
54          * @see net.sourceforge.phpdt.internal.corext.template.java.CompilationUnitContextType#createContext(org.eclipse.jface.text.IDocument, int, int, net.sourceforge.phpdt.core.ICompilationUnit)
55          */
56         public CompilationUnitContext createContext(IDocument document, int offset, int length, ICompilationUnit compilationUnit) {
57                 return new JavaDocContext(this, document, offset, length, compilationUnit);
58         }       
59         
60 }