KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > corext > template > java > JavaVariable


1 /*******************************************************************************
2  * Copyright (c) 2006 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 import org.eclipse.jface.text.templates.TemplateVariableType;
14
15 import org.eclipse.jdt.internal.corext.template.java.CompilationUnitCompletion.Variable;
16
17 import org.eclipse.jdt.internal.ui.text.template.contentassist.MultiVariable;
18
19
20 public final class JavaVariable extends MultiVariable {
21     private String JavaDoc fParamType;
22
23     public JavaVariable(TemplateVariableType type, String JavaDoc name, int[] offsets) {
24         super(type, name, offsets);
25     }
26
27     /*
28      * @see org.eclipse.jdt.internal.ui.text.template.contentassist.MultiVariable#toString(java.lang.Object)
29      * @since 3.3
30      */

31     public String JavaDoc toString(Object JavaDoc object) {
32         if (object instanceof Variable)
33             return ((Variable) object).getName();
34         return super.toString(object);
35     }
36
37     /**
38      * Returns the type given as parameter to this variable.
39      *
40      * @return the type given as parameter to this variable
41      */

42     public String JavaDoc getParamType() {
43         return fParamType;
44     }
45     
46     /**
47      * @param paramType the paramType
48      * @since 3.3
49      */

50     public void setParamType(String JavaDoc paramType) {
51         fParamType= paramType;
52     }
53 }
54
Popular Tags