KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > debug > eval > ast > engine > InterpreterVariable


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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.debug.eval.ast.engine;
12
13
14 import org.eclipse.core.runtime.IStatus;
15 import org.eclipse.core.runtime.Status;
16 import org.eclipse.debug.core.DebugException;
17 import org.eclipse.debug.core.ILaunch;
18 import org.eclipse.debug.core.model.IDebugTarget;
19 import org.eclipse.debug.core.model.IValue;
20 import org.eclipse.jdt.debug.core.IJavaType;
21 import org.eclipse.jdt.debug.core.IJavaVariable;
22 import org.eclipse.jdt.debug.core.JDIDebugModel;
23
24 public class InterpreterVariable implements IJavaVariable {
25
26     /**
27      * The reference type of this variable.
28      */

29     private IJavaType fReferenceType;
30     
31     /**
32      * The variable name.
33      */

34     private String JavaDoc fName;
35     
36     /**
37      * The variable value.
38      */

39     private IValue fValue;
40     
41     private IDebugTarget fDebugTarget;
42
43     public InterpreterVariable(String JavaDoc name, IJavaType referenceType, IDebugTarget debugTarget) {
44         fName= name;
45         fReferenceType= referenceType;
46         fDebugTarget= debugTarget;
47     }
48
49     /**
50      * @see org.eclipse.debug.core.model.IVariable#getValue()
51      */

52     public IValue getValue() {
53         return fValue;
54     }
55
56     /**
57      * @see org.eclipse.debug.core.model.IVariable#getName()
58      */

59     public String JavaDoc getName() {
60         return fName;
61     }
62
63     /**
64      * @see org.eclipse.debug.core.model.IVariable#getReferenceTypeName()
65      */

66     public String JavaDoc getReferenceTypeName() throws DebugException {
67         return fReferenceType.getName();
68     }
69
70     /**
71      * @see org.eclipse.debug.core.model.IVariable#hasValueChanged()
72      */

73     public boolean hasValueChanged() {
74         return false;
75     }
76
77     /**
78      * @see org.eclipse.debug.core.model.IDebugElement#getModelIdentifier()
79      */

80     public String JavaDoc getModelIdentifier() {
81         return JDIDebugModel.getPluginIdentifier();
82     }
83
84     /**
85      * @see org.eclipse.debug.core.model.IDebugElement#getDebugTarget()
86      */

87     public IDebugTarget getDebugTarget() {
88         return fDebugTarget;
89     }
90
91     /**
92      * @see org.eclipse.debug.core.model.IDebugElement#getLaunch()
93      */

94     public ILaunch getLaunch() {
95         return fDebugTarget.getLaunch();
96     }
97
98     /**
99      * @see org.eclipse.debug.core.model.IValueModification#setValue(String)
100      */

101     public void setValue(String JavaDoc expression) throws DebugException {
102         throw new DebugException(new Status(IStatus.ERROR, JDIDebugModel.getPluginIdentifier(), DebugException.NOT_SUPPORTED, EvaluationEngineMessages.InterpreterVariable_setValue_String__not_supported_for_interpreter_variable_1, null));
103     }
104
105     /**
106      * @see org.eclipse.debug.core.model.IValueModification#setValue(IValue)
107      */

108     public void setValue(IValue value) {
109         fValue= value;
110     }
111
112     /**
113      * @see org.eclipse.debug.core.model.IValueModification#supportsValueModification()
114      */

115     public boolean supportsValueModification() {
116         return false;
117     }
118
119     /**
120      * @see org.eclipse.debug.core.model.IValueModification#verifyValue(IValue)
121      */

122     public boolean verifyValue(IValue value) throws DebugException {
123         throw new DebugException(new Status(IStatus.ERROR, JDIDebugModel.getPluginIdentifier(), DebugException.NOT_SUPPORTED, EvaluationEngineMessages.InterpreterVariable_verifyValue_IValue__not_supported_for_interpreter_variable_2, null));
124     }
125
126     /**
127      * @see org.eclipse.debug.core.model.IValueModification#verifyValue(String)
128      */

129     public boolean verifyValue(String JavaDoc expression) throws DebugException {
130         throw new DebugException(new Status(IStatus.ERROR, JDIDebugModel.getPluginIdentifier(), DebugException.NOT_SUPPORTED, EvaluationEngineMessages.InterpreterVariable_verifyValue_String__not_supported_for_interpreter_variable_3, null));
131     }
132
133     /**
134      * @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class)
135      */

136     public Object JavaDoc getAdapter(Class JavaDoc adapter) {
137         return null;
138     }
139
140     /**
141      * @see org.eclipse.jdt.debug.core.IJavaVariable#getJavaType()
142      */

143     public IJavaType getJavaType() {
144         return fReferenceType;
145     }
146
147     /**
148      * @see org.eclipse.jdt.debug.core.IJavaVariable#getSignature()
149      */

150     public String JavaDoc getSignature() throws DebugException {
151         return fReferenceType.getSignature();
152     }
153
154     /**
155      * @see org.eclipse.jdt.debug.core.IJavaModifiers#isFinal()
156      */

157     public boolean isFinal() {
158         return false;
159     }
160
161     /**
162      * @see org.eclipse.jdt.debug.core.IJavaModifiers#isPackagePrivate()
163      */

164     public boolean isPackagePrivate() {
165         return false;
166     }
167
168     /**
169      * @see org.eclipse.jdt.debug.core.IJavaModifiers#isPrivate()
170      */

171     public boolean isPrivate() {
172         return false;
173     }
174
175     /**
176      * @see org.eclipse.jdt.debug.core.IJavaModifiers#isProtected()
177      */

178     public boolean isProtected() {
179         return false;
180     }
181
182     /**
183      * @see org.eclipse.jdt.debug.core.IJavaModifiers#isPublic()
184      */

185     public boolean isPublic() {
186         return true;
187     }
188
189     /**
190      * @see org.eclipse.jdt.debug.core.IJavaModifiers#isStatic()
191      */

192     public boolean isStatic() {
193         return false;
194     }
195
196     /**
197      * @see org.eclipse.jdt.debug.core.IJavaModifiers#isSynthetic()
198      */

199     public boolean isSynthetic() {
200         return true;
201     }
202
203     /**
204      * @see org.eclipse.jdt.debug.core.IJavaVariable#isLocal()
205      */

206     public boolean isLocal() {
207         return false;
208     }
209     
210     /* (non-Javadoc)
211      * @see org.eclipse.jdt.debug.core.IJavaVariable#getGenericSignature()
212      */

213     public String JavaDoc getGenericSignature() throws DebugException {
214         return getSignature();
215     }
216 }
217
Popular Tags