Exemplo n.º 1
0
    @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);
    }
Exemplo n.º 2
0
    private void destroy() {
      DebuggerManager.getDebuggerManager()
          .removeDebuggerListener(DebuggerManager.PROP_WATCHES, this);
      JPDADebugger d = debugger.get();
      if (d != null) d.removePropertyChangeListener(this);

      Watch[] ws = DebuggerManager.getDebuggerManager().getWatches();
      int i, k = ws.length;
      for (i = 0; i < k; i++) ws[i].removePropertyChangeListener(this);

      if (task != null) {
        // cancel old task
        task.cancel();
        if (verbose) System.out.println("WM cancel old task " + task);
        task = null;
      }
    }
Exemplo n.º 3
0
 public boolean isFinished() {
   return task.isFinished();
 }
Exemplo n.º 4
0
 public boolean cancel() {
   if (task.cancel()) {
     return true;
   }
   return false;
 }
Exemplo n.º 5
0
 public void schedule(int delay) {
   task.schedule(delay);
 }
 public void waitFinished() {
   if (task == null) {
     throw new IllegalStateException();
   }
   task.waitFinished();
 }