KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > debug > core > logicalstructures > JavaStructureErrorValue


1 /*******************************************************************************
2  * Copyright (c) 2004, 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.core.logicalstructures;
12
13 import org.eclipse.debug.core.DebugException;
14 import org.eclipse.debug.core.ILaunch;
15 import org.eclipse.debug.core.model.IDebugTarget;
16 import org.eclipse.debug.core.model.IVariable;
17 import org.eclipse.jdt.debug.core.IJavaType;
18 import org.eclipse.jdt.debug.core.IJavaValue;
19 import org.eclipse.jdt.debug.core.JDIDebugModel;
20
21 /**
22  *
23  */

24 public class JavaStructureErrorValue implements IJavaValue {
25     
26     private String JavaDoc[] fMessages;
27     private IJavaValue fValue;
28
29     public JavaStructureErrorValue(String JavaDoc errorMessage, IJavaValue value) {
30         fMessages= new String JavaDoc[] { errorMessage };
31         fValue= value;
32     }
33     
34     public JavaStructureErrorValue(String JavaDoc[] errorMessages, IJavaValue value) {
35         fMessages= errorMessages;
36         fValue= value;
37     }
38     
39     /**
40      * Returns this error node's parent value. This is the value for which a
41      * logical structure could not be calculated.
42      * @return the parent value of this error node
43      */

44     public IJavaValue getParentValue() {
45         return fValue;
46     }
47
48     /* (non-Javadoc)
49      * @see org.eclipse.jdt.debug.core.IJavaValue#getSignature()
50      */

51     public String JavaDoc getSignature() throws DebugException {
52         return null;
53     }
54
55     /* (non-Javadoc)
56      * @see org.eclipse.jdt.debug.core.IJavaValue#getGenericSignature()
57      */

58     public String JavaDoc getGenericSignature() throws DebugException {
59         return null;
60     }
61
62     /* (non-Javadoc)
63      * @see org.eclipse.jdt.debug.core.IJavaValue#getJavaType()
64      */

65     public IJavaType getJavaType() throws DebugException {
66         return null;
67     }
68
69     /* (non-Javadoc)
70      * @see org.eclipse.debug.core.model.IValue#getReferenceTypeName()
71      */

72     public String JavaDoc getReferenceTypeName() throws DebugException {
73         return ""; //$NON-NLS-1$
74
}
75
76     /* (non-Javadoc)
77      * @see org.eclipse.debug.core.model.IValue#getValueString()
78      */

79     public String JavaDoc getValueString() throws DebugException {
80         return fMessages[0];
81     }
82
83     /* (non-Javadoc)
84      * @see org.eclipse.debug.core.model.IValue#isAllocated()
85      */

86     public boolean isAllocated() throws DebugException {
87         return false;
88     }
89
90     /* (non-Javadoc)
91      * @see org.eclipse.debug.core.model.IValue#getVariables()
92      */

93     public IVariable[] getVariables() throws DebugException {
94         IVariable[] variables= new IVariable[fMessages.length];
95         for (int i = 0; i < variables.length; i++) {
96             StringBuffer JavaDoc varName= new StringBuffer JavaDoc();
97             if (variables.length > 1) {
98                 varName.append(LogicalStructuresMessages.JavaStructureErrorValue_0).append('[').append(i).append(']');
99             } else {
100                 varName.append(LogicalStructuresMessages.JavaStructureErrorValue_1);
101             }
102             variables[i]= new JDIPlaceholderVariable(varName.toString(), new JavaStructureErrorValue(fMessages[i], fValue));
103         }
104         return variables;
105     }
106
107     /* (non-Javadoc)
108      * @see org.eclipse.debug.core.model.IValue#hasVariables()
109      */

110     public boolean hasVariables() throws DebugException {
111         return false;
112     }
113
114     /* (non-Javadoc)
115      * @see org.eclipse.debug.core.model.IDebugElement#getModelIdentifier()
116      */

117     public String JavaDoc getModelIdentifier() {
118         return JDIDebugModel.getPluginIdentifier();
119     }
120
121     /* (non-Javadoc)
122      * @see org.eclipse.debug.core.model.IDebugElement#getDebugTarget()
123      */

124     public IDebugTarget getDebugTarget() {
125         return fValue.getDebugTarget();
126     }
127
128     /* (non-Javadoc)
129      * @see org.eclipse.debug.core.model.IDebugElement#getLaunch()
130      */

131     public ILaunch getLaunch() {
132         return getDebugTarget().getLaunch();
133     }
134
135     /* (non-Javadoc)
136      * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
137      */

138     public Object JavaDoc getAdapter(Class JavaDoc adapter) {
139         return null;
140     }
141
142 }
143
Popular Tags