1 11 package org.eclipse.jdt.internal.debug.eval.ast.engine; 12 13 import org.eclipse.core.runtime.CoreException; 14 import org.eclipse.core.runtime.IStatus; 15 import org.eclipse.core.runtime.Status; 16 import org.eclipse.jdt.core.IJavaProject; 17 import org.eclipse.jdt.debug.core.IJavaArray; 18 import org.eclipse.jdt.debug.core.IJavaDebugTarget; 19 import org.eclipse.jdt.debug.core.IJavaObject; 20 import org.eclipse.jdt.debug.core.IJavaReferenceType; 21 import org.eclipse.jdt.debug.core.IJavaThread; 22 import org.eclipse.jdt.debug.core.IJavaType; 23 import org.eclipse.jdt.debug.core.IJavaVariable; 24 import org.eclipse.jdt.internal.debug.core.JDIDebugPlugin; 25 import org.eclipse.jdt.internal.debug.core.logicalstructures.JDIPlaceholderVariable; 26 27 30 public class ArrayRuntimeContext extends AbstractRuntimeContext { 31 32 36 public static String ARRAY_THIS_VARIABLE = "_a_t"; 38 private IJavaArray fArray = null; 39 private IJavaReferenceType fReceivingType = null; 40 private IJavaThread fThread = null; 41 private IJavaVariable fLocalArray = null; 42 43 public ArrayRuntimeContext(IJavaArray arrayObject, IJavaThread thread, IJavaProject project) { 44 super(project); 45 fArray = arrayObject; 46 fThread = thread; 47 fLocalArray = new JDIPlaceholderVariable(ARRAY_THIS_VARIABLE, arrayObject); 48 } 49 50 53 public IJavaDebugTarget getVM() { 54 return (IJavaDebugTarget) fArray.getDebugTarget(); 55 } 56 57 60 public IJavaObject getThis() throws CoreException { 61 return null; 62 } 63 64 67 public IJavaReferenceType getReceivingType() throws CoreException { 68 if (fReceivingType == null) { 69 IJavaType[] javaTypes = getVM().getJavaTypes("java.lang.Object"); if (javaTypes.length > 0) { 71 fReceivingType = (IJavaReferenceType) javaTypes[0]; 72 } else { 73 IStatus status = new Status(IStatus.ERROR, JDIDebugPlugin.getUniqueIdentifier(), JDIDebugPlugin.INTERNAL_ERROR, 74 EvaluationEngineMessages.ArrayRuntimeContext_0, null); 75 throw new CoreException(status); 76 } 77 } 78 return fReceivingType; 79 } 80 81 84 public IJavaVariable[] getLocals() throws CoreException { 85 return new IJavaVariable[]{fLocalArray}; 86 } 87 88 91 public IJavaThread getThread() { 92 return fThread; 93 } 94 95 98 public boolean isConstructor() throws CoreException { 99 return false; 100 } 101 102 } 103 | Popular Tags |