001: /*******************************************************************************
002: * Copyright (c) 2004, 2005 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: *******************************************************************************/package org.eclipse.jdt.internal.debug.core.logicalstructures;
011:
012: import org.eclipse.debug.core.DebugException;
013: import org.eclipse.debug.core.ILaunch;
014: import org.eclipse.debug.core.model.IDebugTarget;
015: import org.eclipse.debug.core.model.IVariable;
016: import org.eclipse.jdt.debug.core.IJavaType;
017: import org.eclipse.jdt.debug.core.IJavaValue;
018: import org.eclipse.jdt.debug.core.JDIDebugModel;
019:
020: /**
021: *
022: */
023: public class JavaStructureErrorValue implements IJavaValue {
024:
025: private String[] fMessages;
026: private IJavaValue fValue;
027:
028: public JavaStructureErrorValue(String errorMessage, IJavaValue value) {
029: fMessages = new String[] { errorMessage };
030: fValue = value;
031: }
032:
033: public JavaStructureErrorValue(String[] errorMessages,
034: IJavaValue value) {
035: fMessages = errorMessages;
036: fValue = value;
037: }
038:
039: /**
040: * Returns this error node's parent value. This is the value for which a
041: * logical structure could not be calculated.
042: * @return the parent value of this error node
043: */
044: public IJavaValue getParentValue() {
045: return fValue;
046: }
047:
048: /* (non-Javadoc)
049: * @see org.eclipse.jdt.debug.core.IJavaValue#getSignature()
050: */
051: public String getSignature() throws DebugException {
052: return null;
053: }
054:
055: /* (non-Javadoc)
056: * @see org.eclipse.jdt.debug.core.IJavaValue#getGenericSignature()
057: */
058: public String getGenericSignature() throws DebugException {
059: return null;
060: }
061:
062: /* (non-Javadoc)
063: * @see org.eclipse.jdt.debug.core.IJavaValue#getJavaType()
064: */
065: public IJavaType getJavaType() throws DebugException {
066: return null;
067: }
068:
069: /* (non-Javadoc)
070: * @see org.eclipse.debug.core.model.IValue#getReferenceTypeName()
071: */
072: public String getReferenceTypeName() throws DebugException {
073: return ""; //$NON-NLS-1$
074: }
075:
076: /* (non-Javadoc)
077: * @see org.eclipse.debug.core.model.IValue#getValueString()
078: */
079: public String getValueString() throws DebugException {
080: return fMessages[0];
081: }
082:
083: /* (non-Javadoc)
084: * @see org.eclipse.debug.core.model.IValue#isAllocated()
085: */
086: public boolean isAllocated() throws DebugException {
087: return false;
088: }
089:
090: /* (non-Javadoc)
091: * @see org.eclipse.debug.core.model.IValue#getVariables()
092: */
093: public IVariable[] getVariables() throws DebugException {
094: IVariable[] variables = new IVariable[fMessages.length];
095: for (int i = 0; i < variables.length; i++) {
096: StringBuffer varName = new StringBuffer();
097: if (variables.length > 1) {
098: varName
099: .append(
100: LogicalStructuresMessages.JavaStructureErrorValue_0)
101: .append('[').append(i).append(']');
102: } else {
103: varName
104: .append(LogicalStructuresMessages.JavaStructureErrorValue_1);
105: }
106: variables[i] = new JDIPlaceholderVariable(varName
107: .toString(), new JavaStructureErrorValue(
108: fMessages[i], fValue));
109: }
110: return variables;
111: }
112:
113: /* (non-Javadoc)
114: * @see org.eclipse.debug.core.model.IValue#hasVariables()
115: */
116: public boolean hasVariables() throws DebugException {
117: return false;
118: }
119:
120: /* (non-Javadoc)
121: * @see org.eclipse.debug.core.model.IDebugElement#getModelIdentifier()
122: */
123: public String getModelIdentifier() {
124: return JDIDebugModel.getPluginIdentifier();
125: }
126:
127: /* (non-Javadoc)
128: * @see org.eclipse.debug.core.model.IDebugElement#getDebugTarget()
129: */
130: public IDebugTarget getDebugTarget() {
131: return fValue.getDebugTarget();
132: }
133:
134: /* (non-Javadoc)
135: * @see org.eclipse.debug.core.model.IDebugElement#getLaunch()
136: */
137: public ILaunch getLaunch() {
138: return getDebugTarget().getLaunch();
139: }
140:
141: /* (non-Javadoc)
142: * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
143: */
144: public Object getAdapter(Class adapter) {
145: return null;
146: }
147:
148: }
|