void (final AbstractTreeNode parentElement, final Object[] children) { myCurrentParent = parentElement; Future<?> future = AppExecutorUtil.getAppScheduledExecutorService().schedule( () -> myList.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)), 200, TimeUnit.MILLISECONDS ); myModel.removeAllElements(); if (shouldAddTopElement()) { Object value = parentElement.getValue(); if (value != null) { myModel.addElement(new TopLevelNode(myProject, value)); } } for (Object aChildren : children) { AbstractTreeNode child = (AbstractTreeNode)aChildren; ReadAction.run(() -> child.update()); } if (myComparator != null) { Arrays.sort(children, myComparator); } for (Object aChildren : children) { myModel.addElement(aChildren); } boolean canceled = future.cancel(false); if (!canceled) { ApplicationManager.getApplication().executeOnPooledThread(() -> myList.setCursor(Cursor.getDefaultCursor())); } }