void () { if (myUpdateLabelsAlarm.isDisposed()) { return; } myUpdateLabelsAlarm.cancelAllRequests(); myUpdateLabelsAlarm.addRequest(new Runnable() { @Override public void run() { boolean updateScheduled = false; try { if (isUpdateEnabled()) { final ThreadsDebuggerTree tree = getThreadsTree(); final DebuggerTreeNodeImpl root = (DebuggerTreeNodeImpl)tree.getModel().getRoot(); if (root != null) { final DebugProcessImpl process = getContext().getDebugProcess(); if (process != null) { process.getManagerThread().invoke(new DebuggerCommandImpl() { @Override protected void action() { try { updateNodeLabels(root); } finally { reschedule(); } } @Override protected void commandCancelled() { reschedule(); } }); updateScheduled = true; } } } } finally { if (!updateScheduled) { reschedule(); } } } private void reschedule() { final DebuggerSession session = getContext().getDebuggerSession(); if (session != null && session.isAttached() && !session.isPaused() && !myUpdateLabelsAlarm.isDisposed()) { myUpdateLabelsAlarm.addRequest(this, LABELS_UPDATE_DELAY_MS, ModalityState.nonModal()); } } }, LABELS_UPDATE_DELAY_MS, ModalityState.nonModal()); }