1 22 23 package org.aspectj.debugger.request; 24 25 import org.aspectj.debugger.base.*; 26 import org.aspectj.debugger.gui.*; 27 import org.aspectj.debugger.ide.IDEInterface; 28 import org.aspectj.tools.ide.*; 29 import java.io.File ; 30 import com.sun.jdi.*; 31 import com.sun.jdi.event.*; 32 import com.sun.jdi.request.*; 33 34 42 43 public abstract class BreakpointRequestAction 44 extends RequestAction 45 implements IDEInterface.SourceLineBreakable 46 { 47 48 private Location location; 49 50 public BreakpointRequestAction(Debugger debugger) { 51 super(debugger); 52 if (!isSetting()) { 53 debugger.removeStopListener(this); 54 } 55 } 56 57 public boolean isBreakpoint() { 58 return true; 59 } 60 61 public abstract int getLine(); 62 public abstract String getSourceName(); 63 public abstract String getProto(); 64 65 public int getRealLine() { 66 return getLine(); 67 } 68 public String getRealSourceName() { 69 return getSourceName(); 70 } 71 72 protected void setLocation(Location location) { 73 this.location = location; 74 } 75 76 protected BreakpointRequest request(Location location) throws NoVMException { 77 setLocation(location); 78 BreakpointRequest req = (BreakpointRequest)getRequest(); 79 if (isSetting()) { 80 req = vm().eventRequestManager().createBreakpointRequest(getLocation()); 81 req.setSuspendPolicy(EventRequest.SUSPEND_ALL); 82 req.enable(); 83 } else if (req != null) { 84 vm().eventRequestManager().deleteEventRequest(req); 85 } 86 return req; 87 } 88 89 public Location getLocation() { 90 return location; 91 } 92 93 public String toString() { 94 return "breakpoint " + getProto(); 95 } 96 97 public SourceLine sourceLine() { 98 return null; 99 } 100 101 public boolean equals(Object o) { 102 if (o instanceof AJStackFrameFormatter.MethodAndSource) { 103 AJStackFrameFormatter.MethodAndSource ms = (AJStackFrameFormatter.MethodAndSource)o; 104 return ms != null && getProto().equals(ms.getProto()); 105 } 106 if (o instanceof BreakpointRequestAction) { 107 BreakpointRequestAction bra = (BreakpointRequestAction)o; 108 return 109 getRealSourceName().equals(bra.getRealSourceName()) && 111 getRealLine() == bra.getRealLine(); 112 } 113 return super.equals(o); 114 } 115 116 public void breakpointEvent(BreakpointEvent e) { print(e); } 117 } 118 | Popular Tags |