void (@NotNull File fromFile, @NotNull File toFile, boolean wasCustom) { final SchemeManager<ShelvedChangeList> newSchemeManager = createShelveSchemeManager(myProject, VcsUtil.getFilePath(toFile).getPath()); newSchemeManager.loadSchemes(); if (VcsConfiguration.getInstance(myProject).MOVE_SHELVES && fromFile.exists()) { new Task.Modal(myProject, VcsBundle.message("shelve.copying.shelves.to.progress"), true) { @Override public void run(@NotNull ProgressIndicator indicator) { for (ShelvedChangeList list : schemeManager.getAllSchemes()) { if (!list.isValid()) continue; try { Path newTargetDirectory = suggestPatchName(myProject, list.DESCRIPTION, toFile, "").toPath(); ShelvedChangeList migratedList = createChangelistCopyWithChanges(list, newTargetDirectory); newSchemeManager.addScheme(migratedList, false); indicator.checkCanceled(); } catch (IOException e) { LOG.error("Can't copy patch file: " + list.path); } } clearShelvedLists(schemeManager.getAllSchemes(), false); } @Override public void onSuccess() { super.onSuccess(); updateShelveSchemaManager(newSchemeManager); } @Override public void onCancel() { super.onCancel(); suggestToCancelMigrationOrRevertPathToPrevious(); } // private void suggestToCancelMigrationOrRevertPathToPrevious() { if (Messages.showOkCancelDialog(myProject, VcsBundle.message("shelve.moving.failed.prompt"), VcsBundle.message("shelve.error.title"), VcsBundle.message("shelve.use.new.directory.button"), VcsBundle.message("shelve.revert.moving.button"), UIUtil.getWarningIcon()) == Messages.OK) { updateShelveSchemaManager(newSchemeManager); } else { VcsConfiguration vcsConfiguration = VcsConfiguration.getInstance(myProject); vcsConfiguration.USE_CUSTOM_SHELF_PATH = wasCustom; if (wasCustom) { vcsConfiguration.CUSTOM_SHELF_PATH = FileUtil.toSystemIndependentName(fromFile.getPath()); } } } @Override public void onThrowable(@NotNull Throwable error) { super.onThrowable(error); suggestToCancelMigrationOrRevertPathToPrevious(); } }.queue(); } else { updateShelveSchemaManager(newSchemeManager); } }