]> git.uio.no Git - ifi-stolz-refaktor.git/blob - case-study/jdt-after/core extension/org/eclipse/jdt/internal/corext/template/java/SWTContextType.java
Case Study: adding data and statistics
[ifi-stolz-refaktor.git] / case-study / jdt-after / core extension / org / eclipse / jdt / internal / corext / template / java / SWTContextType.java
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
7  *
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package org.eclipse.jdt.internal.corext.template.java;
12
13
14
15 /**
16  * The context type for templates inside SWT 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  * @since 3.4
24  */
25 public class SWTContextType extends AbstractJavaContextType {
26
27         /**
28          * The context type id for templates working on all Java code locations in SWT projects
29          */
30         public static final String ID_ALL= "swt"; //$NON-NLS-1$
31
32         /**
33          * The context type id for templates working on member locations in SWT projects
34          */
35         public static final String ID_MEMBERS= "swt-members"; //$NON-NLS-1$
36
37         /**
38          * The context type id for templates working on statement locations in SWT projects
39          */
40         public static final String ID_STATEMENTS= "swt-statements"; //$NON-NLS-1$
41
42
43         /* (non-Javadoc)
44          * @see org.eclipse.jdt.internal.corext.template.java.AbstractJavaContextType#initializeContext(org.eclipse.jdt.internal.corext.template.java.JavaContext)
45          */
46         @Override
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);
50                 }
51         }
52 }