]> git.uio.no Git - ifi-stolz-refaktor.git/blob - case-study/jdt-before/core extension/org/eclipse/jdt/internal/corext/template/java/JavaContextType.java
Case Study: adding data and statistics
[ifi-stolz-refaktor.git] / case-study / jdt-before / core extension / org / eclipse / jdt / internal / corext / template / java / JavaContextType.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2011 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *     Sebastian Davids: sdavids@gmx.de - see bug 25376
11  *******************************************************************************/
12 package org.eclipse.jdt.internal.corext.template.java;
13
14
15 /**
16  * The context type for templates inside Java code.
17  * The same class is used for several context types:
18  * <dl>
19  * <li>templates for all Java code locations</li>
20  * <li>templates for member locations</li>
21  * <li>templates for statement locations</li>
22  * </dl>
23  */
24 public class JavaContextType extends AbstractJavaContextType {
25
26         /**
27          * The context type id for templates working on all Java code locations
28          */
29         public static final String ID_ALL= "java"; //$NON-NLS-1$
30
31         /**
32          * The context type id for templates working on member locations
33          */
34         public static final String ID_MEMBERS= "java-members"; //$NON-NLS-1$
35
36         /**
37          * The context type id for templates working on statement locations
38          */
39         public static final String ID_STATEMENTS= "java-statements"; //$NON-NLS-1$
40
41
42         /* (non-Javadoc)
43          * @see org.eclipse.jdt.internal.corext.template.java.AbstractJavaContextType#initializeContext(org.eclipse.jdt.internal.corext.template.java.JavaContext)
44          */
45         @Override
46         protected void initializeContext(JavaContext context) {
47                 if (!getId().equals(JavaContextType.ID_ALL)) { // a specific context must also allow the templates that work everywhere
48                         context.addCompatibleContextType(JavaContextType.ID_ALL);
49                 }
50         }
51
52 }