1 19 20 package org.netbeans.api.debugger; 21 22 import java.beans.PropertyChangeListener ; 23 import java.beans.PropertyChangeSupport ; 24 25 30 public abstract class Breakpoint { 31 32 33 34 public static final String PROP_ENABLED = "enabled"; 36 public static final String PROP_DISPOSED = "disposed"; 38 public static final String PROP_GROUP_NAME = "groupName"; 40 public static final String PROP_VALIDITY = "validity"; 42 43 public static enum VALIDITY { UNKNOWN, VALID, INVALID } 44 45 46 private PropertyChangeSupport pcs; 47 private String groupName = ""; 48 private VALIDITY validity = VALIDITY.UNKNOWN; 49 private String validityMessage; 50 51 { pcs = new PropertyChangeSupport (this); } 52 53 56 protected void dispose () {} 57 58 63 public abstract boolean isEnabled (); 64 65 68 public abstract void disable (); 69 70 73 public abstract void enable (); 74 75 79 public final synchronized VALIDITY getValidity() { 80 return validity; 81 } 82 83 89 public final synchronized String getValidityMessage() { 90 return validityMessage; 91 } 92 93 98 protected final void setValidity(VALIDITY validity, String reason) { 99 VALIDITY old; 100 synchronized (this) { 101 this.validityMessage = reason; 102 if (this.validity == validity) return ; 103 old = this.validity; 104 this.validity = validity; 105 } 106 firePropertyChange(PROP_VALIDITY, old, validity); 107 } 108 109 public String getGroupName () { 110 return groupName; 111 } 112 113 public void setGroupName (String newGroupName) { 114 if (groupName.equals (newGroupName)) return; 115 String old = groupName; 116 groupName = newGroupName.intern(); 117 firePropertyChange (PROP_GROUP_NAME, old, newGroupName); 118 } 119 120 125 public synchronized void addPropertyChangeListener ( 126 PropertyChangeListener listener 127 ) { 128 pcs.addPropertyChangeListener (listener); 129 } 130 131 136 public synchronized void removePropertyChangeListener ( 137 PropertyChangeListener listener 138 ) { 139 pcs.removePropertyChangeListener (listener); 140 } 141 142 148 public void addPropertyChangeListener ( 149 String propertyName, PropertyChangeListener l 150 ) { 151 pcs.addPropertyChangeListener (propertyName, l); 152 } 153 154 160 public void removePropertyChangeListener ( 161 String propertyName, PropertyChangeListener l 162 ) { 163 pcs.removePropertyChangeListener (propertyName, l); 164 } 165 166 173 protected void firePropertyChange (String name, Object o, Object n) { 174 pcs.firePropertyChange (name, o, n); 175 } 176 177 180 void disposeOut () { 181 dispose (); 182 firePropertyChange (PROP_DISPOSED, Boolean.FALSE, Boolean.TRUE); 183 } 184 } 185 | Popular Tags |