1 /*******************************************************************************
2 * Copyright (c) 2007, 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 *******************************************************************************/
11 package org.eclipse.jdt.internal.corext.template.java;
16 * The context type for templates inside SWT 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>
25 public class SWTContextType extends AbstractJavaContextType {
28 * The context type id for templates working on all Java code locations in SWT projects
30 public static final String ID_ALL= "swt"; //$NON-NLS-1$
33 * The context type id for templates working on member locations in SWT projects
35 public static final String ID_MEMBERS= "swt-members"; //$NON-NLS-1$
38 * The context type id for templates working on statement locations in SWT projects
40 public static final String ID_STATEMENTS= "swt-statements"; //$NON-NLS-1$
44 * @see org.eclipse.jdt.internal.corext.template.java.AbstractJavaContextType#initializeContext(org.eclipse.jdt.internal.corext.template.java.JavaContext)
47 protected void initializeContext(JavaContext context) {
48 if (!getId().equals(SWTContextType.ID_ALL)) { // a specific context must also allow the templates that work everywhere
49 context.addCompatibleContextType(SWTContextType.ID_ALL);