@AsynchronousExecution public void scheduleUnshelveChangeList( final ShelvedChangeList changeList, @Nullable final List<ShelvedChange> changes, @Nullable final List<ShelvedBinaryFile> binaryFiles, @Nullable final LocalChangeList targetChangeList, final boolean showSuccessNotification, final ContinuationContext context, final boolean silentAddDelete) { context.next( new TaskDescriptor("", Where.AWT) { @Override public void run(ContinuationContext contextInner) { final List<FilePatch> remainingPatches = new ArrayList<FilePatch>(); final CommitContext commitContext = new CommitContext(); final List<TextFilePatch> textFilePatches; try { textFilePatches = loadTextPatches(myProject, changeList, changes, remainingPatches, commitContext); } catch (IOException e) { LOG.info(e); PatchApplier.showError(myProject, "Cannot load patch(es): " + e.getMessage(), true); return; } catch (PatchSyntaxException e) { PatchApplier.showError(myProject, "Cannot load patch(es): " + e.getMessage(), true); LOG.info(e); return; } final List<FilePatch> patches = new ArrayList<FilePatch>(textFilePatches); final List<ShelvedBinaryFile> remainingBinaries = new ArrayList<ShelvedBinaryFile>(); final List<ShelvedBinaryFile> binaryFilesToUnshelve = getBinaryFilesToUnshelve(changeList, binaryFiles, remainingBinaries); for (final ShelvedBinaryFile shelvedBinaryFile : binaryFilesToUnshelve) { patches.add(new ShelvedBinaryFilePatch(shelvedBinaryFile)); } final BinaryPatchApplier binaryPatchApplier = new BinaryPatchApplier(binaryFilesToUnshelve.size()); final PatchApplier<ShelvedBinaryFilePatch> patchApplier = new PatchApplier<ShelvedBinaryFilePatch>( myProject, myProject.getBaseDir(), patches, targetChangeList, binaryPatchApplier, commitContext); // after patch applier part contextInner.next( new TaskDescriptor("", Where.AWT) { @Override public void run(ContinuationContext context) { remainingPatches.addAll(patchApplier.getRemainingPatches()); if ((remainingPatches.size() == 0) && remainingBinaries.isEmpty()) { recycleChangeList(changeList); } else { saveRemainingPatches( changeList, remainingPatches, remainingBinaries, commitContext); } } }); patchApplier.scheduleSelf(showSuccessNotification, contextInner, silentAddDelete); } }); }