1 11 package org.eclipse.jdt.internal.debug.eval.ast.engine; 12 13 14 import org.eclipse.core.runtime.CoreException; 15 import org.eclipse.jdt.core.IJavaProject; 16 import org.eclipse.jdt.debug.core.IJavaDebugTarget; 17 import org.eclipse.jdt.debug.core.IJavaObject; 18 import org.eclipse.jdt.debug.core.IJavaReferenceType; 19 import org.eclipse.jdt.debug.core.IJavaStackFrame; 20 import org.eclipse.jdt.debug.core.IJavaThread; 21 import org.eclipse.jdt.debug.core.IJavaVariable; 22 23 public class RuntimeContext extends AbstractRuntimeContext { 24 25 28 private IJavaStackFrame fFrame; 29 30 39 public RuntimeContext(IJavaProject project, IJavaStackFrame frame) { 40 super(project); 41 setFrame(frame); 42 } 43 44 47 public IJavaDebugTarget getVM() { 48 return (IJavaDebugTarget)getFrame().getDebugTarget(); 49 } 50 51 54 public IJavaObject getThis() throws CoreException { 55 return getFrame().getThis(); 56 } 57 58 61 public IJavaReferenceType getReceivingType() throws CoreException { 62 IJavaObject rec = getThis(); 63 if (rec != null) { 64 return (IJavaReferenceType)rec.getJavaType(); 65 } 66 return getFrame().getReferenceType(); 67 } 68 69 72 public IJavaVariable[] getLocals() throws CoreException { 73 return getFrame().getLocalVariables(); 74 } 75 76 81 protected IJavaStackFrame getFrame() { 82 return fFrame; 83 } 84 85 90 private void setFrame(IJavaStackFrame frame) { 91 fFrame = frame; 92 } 93 94 97 public IJavaThread getThread() { 98 return (IJavaThread)getFrame().getThread(); 99 } 100 101 104 public boolean isConstructor() throws CoreException { 105 return getFrame().isConstructor(); 106 } 107 108 } 109 110 | Popular Tags |