1 19 20 package org.netbeans.modules.debugger.ui; 21 22 import java.beans.PropertyChangeEvent ; 23 import org.netbeans.api.debugger.Breakpoint; 24 import org.netbeans.api.debugger.DebuggerEngine; 25 import org.netbeans.api.debugger.DebuggerManager; 26 import org.netbeans.api.debugger.LazyDebuggerManagerListener; 27 import org.netbeans.api.debugger.Properties; 28 import org.netbeans.api.debugger.Session; 29 import org.netbeans.api.debugger.Watch; 30 31 32 40 public class PersistenceManager implements LazyDebuggerManagerListener { 41 42 public Breakpoint[] initBreakpoints () { 43 return new Breakpoint [0]; 44 } 45 46 public void initWatches () { 47 Properties p = Properties.getDefault ().getProperties ("debugger"); 49 p.getArray ( 50 DebuggerManager.PROP_WATCHES, 51 new Watch [0] 52 ); 53 } 54 55 public String [] getProperties () { 56 return new String [] { 57 DebuggerManager.PROP_WATCHES_INIT, 58 DebuggerManager.PROP_WATCHES 59 }; 60 } 61 62 public void breakpointAdded (Breakpoint breakpoint) { 63 } 64 65 public void breakpointRemoved (Breakpoint breakpoint) { 66 } 67 68 public void watchAdded (Watch watch) { 69 Properties p = Properties.getDefault ().getProperties ("debugger"); 70 p.setArray ( 71 DebuggerManager.PROP_WATCHES, 72 DebuggerManager.getDebuggerManager ().getWatches () 73 ); 74 watch.addPropertyChangeListener (this); 75 } 76 77 public void watchRemoved (Watch watch) { 78 Properties p = Properties.getDefault ().getProperties ("debugger"); 79 p.setArray ( 80 DebuggerManager.PROP_WATCHES, 81 DebuggerManager.getDebuggerManager ().getWatches () 82 ); 83 watch.removePropertyChangeListener(this); 84 } 85 86 public void propertyChange (PropertyChangeEvent evt) { 87 if (evt.getSource() instanceof Watch) { 88 Properties.getDefault ().getProperties ("debugger").setArray ( 89 DebuggerManager.PROP_WATCHES, 90 DebuggerManager.getDebuggerManager ().getWatches () 91 ); 92 } 93 } 94 95 public void sessionAdded (Session session) {} 96 public void sessionRemoved (Session session) {} 97 public void engineAdded (DebuggerEngine engine) {} 98 public void engineRemoved (DebuggerEngine engine) {} 99 } 100 | Popular Tags |