@Override
    public void propertyChange(PropertyChangeEvent evt) {
      String propName = evt.getPropertyName();
      // We already have watchAdded & watchRemoved. Ignore PROP_WATCHES:
      // We care only about the current call stack frame change and watch expression change here...
      if (!(JPDADebugger.PROP_STATE.equals(propName)
          || Watch.PROP_EXPRESSION.equals(propName)
          || Watch.PROP_ENABLED.equals(propName)
          || JPDADebugger.PROP_CURRENT_CALL_STACK_FRAME.equals(propName))) return;
      final WatchesModel m = getModel();
      if (m == null) return;
      if (JPDADebugger.PROP_STATE.equals(propName)
          && m.debugger.getState() == JPDADebugger.STATE_DISCONNECTED) {

        destroy();
        return;
      }
      if (m.debugger.getState() == JPDADebugger.STATE_RUNNING
          || JPDADebugger.PROP_CURRENT_CALL_STACK_FRAME.equals(propName)
              && m.debugger.getCurrentCallStackFrame() == null) {

        return;
      }

      if (evt.getSource() instanceof Watch) {
        Object node;
        synchronized (m.watchToValue) {
          node = m.watchToValue.get(evt.getSource());
        }
        if (node != null) {
          m.fireTableValueChangedChanged(node, null);
          return;
        }
      }

      if (task == null) {
        task =
            m.debugger
                .getRequestProcessor()
                .create(
                    new Runnable() {
                      public void run() {
                        if (verbose) System.out.println("WM do task " + task);
                        m.fireTreeChanged();
                      }
                    });
        if (verbose) System.out.println("WM  create task " + task);
      }
      task.schedule(100);
    }
Beispiel #2
0
 public void schedule(int delay) {
   task.schedule(delay);
 }