1 19 20 package org.netbeans.api.debugger.jpda; 21 22 23 37 public final class ExceptionBreakpoint extends JPDABreakpoint { 38 39 40 public static final String PROP_EXCEPTION_CLASS_NAME = "exceptionClassName"; 42 public static final String PROP_CATCH_TYPE = "catchType"; 44 public static final String PROP_CONDITION = "condition"; 46 47 public static final int TYPE_EXCEPTION_CATCHED = 1; 48 49 public static final int TYPE_EXCEPTION_UNCATCHED = 2; 50 51 public static final int TYPE_EXCEPTION_CATCHED_UNCATCHED = 3; 52 53 private String exceptionClassName = ""; 54 private int catchType = TYPE_EXCEPTION_UNCATCHED; 55 private String condition = ""; 57 58 private ExceptionBreakpoint () { 59 } 60 61 69 public static ExceptionBreakpoint create ( 70 String exceptionClassName, 71 int catchType 72 ) { 73 ExceptionBreakpoint b = new ExceptionBreakpoint (); 74 b.setExceptionClassName (exceptionClassName); 75 b.setCatchType (catchType); 76 return b; 77 } 78 79 84 public String getExceptionClassName () { 85 return exceptionClassName; 86 } 87 88 93 public void setExceptionClassName (String cn) { 94 if (cn != null) { 95 cn = cn.trim(); 96 } 97 if ( (cn == exceptionClassName) || 98 ((cn != null) && (exceptionClassName != null) && exceptionClassName.equals (cn)) 99 ) return; 100 Object old = exceptionClassName; 101 exceptionClassName = cn; 102 firePropertyChange (PROP_EXCEPTION_CLASS_NAME, old, exceptionClassName); 103 } 104 105 110 public String getCondition () { 111 return condition; 112 } 113 114 119 public void setCondition (String cond) { 120 if (cond != null) { 121 cond = cond.trim(); 122 } 123 String old = condition; 124 condition = cond; 125 firePropertyChange (PROP_CONDITION, old, cond); 126 } 127 128 133 public int getCatchType () { 134 return catchType; 135 } 136 137 142 public void setCatchType (int catchType) { 143 if (catchType == this.catchType) return; 144 if ( (catchType & (TYPE_EXCEPTION_CATCHED | TYPE_EXCEPTION_UNCATCHED)) == 0 145 ) throw new IllegalArgumentException (); 146 int old = this.catchType; 147 this.catchType = catchType; 148 firePropertyChange ( 149 PROP_CATCH_TYPE, 150 new Integer (old), 151 new Integer (catchType) 152 ); 153 } 154 155 160 public String toString () { 161 return "ExceptionBreakpoint" + exceptionClassName; 162 } 163 } 164 | Popular Tags |