void (final DirDiffElementImpl element) { DiffElement<?> source = element.getSource(); if (source != null) { String path = element.getParentNode().getPath(); if (source instanceof AsyncDiffElement) { ((AsyncDiffElement)source).copyToAsync(myTarget, element.getTarget(), path) .onError(error -> reportException(error == null ? null : error.getMessage())) .onSuccess(newElement -> refreshAfterCopyTo(element, newElement)); } else { WriteAction.run(() -> { DiffElement<?> diffElement = source.copyTo(myTarget, path); refreshElementAfterCopyTo(diffElement, element); }); } } }