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
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;
16 * The context type for templates inside Java code.
17 * The same class is used for several context types:
19 * <li>templates for all Java code locations</li>
20 * <li>templates for member locations</li>
21 * <li>templates for statement locations</li>
24 public class JavaContextType extends AbstractJavaContextType {
27 * The context type id for templates working on all Java code locations
29 public static final String ID_ALL= "java"; //$NON-NLS-1$
32 * The context type id for templates working on member locations
34 public static final String ID_MEMBERS= "java-members"; //$NON-NLS-1$
37 * The context type id for templates working on statement locations
39 public static final String ID_STATEMENTS= "java-statements"; //$NON-NLS-1$
43 * @see org.eclipse.jdt.internal.corext.template.java.AbstractJavaContextType#initializeContext(org.eclipse.jdt.internal.corext.template.java.JavaContext)
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);