private void _addTestOrSuite(@NotNull final SMTestProxy newTestOrSuite) { final SMTestProxy parentSuite = newTestOrSuite.getParent(); assert parentSuite != null; // Tree final Update update = new Update(parentSuite) { @Override public void run() { myRequests.remove(this); myTreeBuilder.updateTestsSubtree(parentSuite); } }; if (ApplicationManager.getApplication().isUnitTestMode()) { update.run(); } else if (myRequests.add(update) && !myUpdateQueue.isDisposed()) { myUpdateQueue.addRequest(update, 100); } myTreeBuilder.repaintWithParents(newTestOrSuite); myAnimator.setCurrentTestCase(newTestOrSuite); if (TestConsoleProperties.TRACK_RUNNING_TEST.value(myProperties)) { if (myLastSelected == null || myLastSelected == newTestOrSuite) { myLastSelected = null; selectAndNotify(newTestOrSuite); } } }
@Override public void queue(@NotNull Update update) { boolean passThrough = false; if (ApplicationManager.getApplication().isUnitTestMode()) { passThrough = isPassThrough(); } else if (MavenUtil.isNoBackgroundMode()) { passThrough = true; } if (passThrough) { update.run(); return; } super.queue(update); }
public final void setText(final String text, boolean now, @Nullable final Runnable onDone) { final Update update = new Update("pathFromTree") { public void run() { myPathIsUpdating = true; getField().setText(text); myPathIsUpdating = false; if (onDone != null) { onDone.run(); } } }; if (now) { update.run(); } else { myUiUpdater.queue(update); } }