1 11 package org.eclipse.jdt.internal.debug.eval.ast.instructions; 12 13 14 import org.eclipse.core.runtime.CoreException; 15 import org.eclipse.core.runtime.IStatus; 16 import org.eclipse.core.runtime.Status; 17 import org.eclipse.jdt.debug.core.IJavaObject; 18 import org.eclipse.jdt.internal.debug.core.JDIDebugPlugin; 19 import org.eclipse.jdt.internal.debug.core.model.JDIObjectValue; 20 import org.eclipse.jdt.internal.debug.eval.ast.engine.IRuntimeContext; 21 22 25 public class PushThis extends SimpleInstruction { 26 27 private int fEnclosingLevel; 28 29 public PushThis(int enclosingLevel) { 30 fEnclosingLevel= enclosingLevel; 31 } 32 33 public void execute() throws CoreException { 34 IRuntimeContext context= getContext(); 35 IJavaObject thisInstance = context.getThis(); 36 if (thisInstance == null) { 37 push(context.getReceivingType()); 39 } else { 40 if (fEnclosingLevel != 0) { 41 thisInstance= ((JDIObjectValue)thisInstance).getEnclosingObject(fEnclosingLevel); 42 if (thisInstance == null) { 43 throw new CoreException(new Status(IStatus.ERROR, JDIDebugPlugin.getUniqueIdentifier(), IStatus.OK, InstructionsEvaluationMessages.PushThis_Unable_to_retrieve_the_correct_enclosing_instance_of__this__2, null)); 44 } 45 } 46 push(thisInstance); 47 } 48 } 49 50 public String toString() { 51 return InstructionsEvaluationMessages.PushThis_push___this__1; 52 } 53 } 54 55 | Popular Tags |