1 22 23 package org.aspectj.debugger.request; 24 25 import org.aspectj.debugger.base.*; 26 27 import com.sun.jdi.*; 28 import com.sun.jdi.request.*; 29 import com.sun.jdi.event.*; 30 import java.util.*; 31 32 40 41 public abstract class ClassBreakpointRequestAction extends BreakpointRequestAction { 42 43 protected String className; 44 45 ClassBreakpointRequestAction(Debugger debugger, String className) { 46 super(debugger); 47 this.className = className; 48 } 49 50 EventRequest resolve(ReferenceType refType) 51 throws MultipleLocationsException, 52 UnableToSetRequestException { 53 BreakpointRequest request = null; 54 try { 55 if (refType.name().equals(className)) { 56 EventRequestManager em = vm().eventRequestManager(); 57 Location location = findLocation(); 58 if (location == null) { 59 return null; 60 } 61 request = request(location); 62 } 63 } catch (NoVMException e) { 64 } 65 return request; 66 } 67 68 public String getRealSourceName() { 69 return ajdbg().getFullSourcePathFromAJCClass(getClassName()); 70 } 71 72 public String getClassName() { 73 return className; 74 } 75 76 public int getLine() { 77 if (getLocation() != null) { 78 return getLocation().lineNumber(); 79 } 80 return -1; 81 } 82 83 public String getSourceName() { 84 if (getLocation() != null) { 85 try { 86 return getLocation().sourceName(); 87 } catch (AbsentInformationException aie) { 88 } 89 } 90 return "<not-available>"; 91 } 92 93 abstract Location findLocation() 94 throws NoVMException, 95 MultipleLocationsException, 96 UnableToSetRequestException; 97 } 98 | Popular Tags |