void () { final FileChooserDescriptor descriptor = myDirectorySelector ? FileChooserDescriptorFactory.createSingleFolderDescriptor() : FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor(); descriptor.setTitle(VcsBundle.message("patch.apply.select.base.title", myDirectorySelector ? 0 : 1)); VirtualFile selectedFile = FileChooser.chooseFile(descriptor, myProject, null); if (selectedFile == null) { return; } final List<AbstractFilePatchInProgress.PatchChange> selectedChanges = myChangesTreeList.getSelectedChanges(); if (selectedChanges.size() >= 1) { for (AbstractFilePatchInProgress.PatchChange patchChange : selectedChanges) { final AbstractFilePatchInProgress patch = patchChange.getPatchInProgress(); if (myDirectorySelector) { patch.setNewBase(selectedFile); } else { final FilePatch filePatch = patch.getPatch(); //if file was renamed in the patch but applied on another or already renamed local one then we shouldn't apply this rename/move filePatch.setAfterName(selectedFile.getName()); filePatch.setBeforeName(selectedFile.getName()); patch.setNewBase(selectedFile.getParent()); } } updateTree(false); } }