Search in sources :

Example 1 with ApplyPatchDifferentiatedDialog

use of com.intellij.openapi.vcs.changes.patch.ApplyPatchDifferentiatedDialog in project intellij-community by JetBrains.

the class MergeFromTheirsResolver method selectPatchesInApplyPatchDialog.

@CalledInAwt
private void selectPatchesInApplyPatchDialog(@NotNull Consumer<VcsException> callback) throws VcsException {
    LocalChangeList changeList = ChangeListManager.getInstance(myVcs.getProject()).getChangeList(myChange);
    TreeConflictApplyTheirsPatchExecutor patchExecutor = new TreeConflictApplyTheirsPatchExecutor(myVcs, myBaseForPatch);
    ApplyPatchDifferentiatedDialog dialog = new ApplyPatchDifferentiatedDialog(myVcs.getProject(), patchExecutor, singletonList(new ApplyPatchSaveToFileExecutor(myVcs.getProject(), myBaseForPatch)), ApplyPatchMode.APPLY_PATCH_IN_MEMORY, myTextPatches, changeList);
    // dialog is not modal - so such async behavior is used
    patchExecutor.myPromise.done(callback);
    dialog.show();
}
Also used : ApplyPatchDifferentiatedDialog(com.intellij.openapi.vcs.changes.patch.ApplyPatchDifferentiatedDialog) CalledInAwt(org.jetbrains.annotations.CalledInAwt)

Example 2 with ApplyPatchDifferentiatedDialog

use of com.intellij.openapi.vcs.changes.patch.ApplyPatchDifferentiatedDialog in project intellij-community by JetBrains.

the class UnshelveWithDialogAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    final Project project = ObjectUtils.assertNotNull(getEventProject(e));
    DataContext dataContext = e.getDataContext();
    final List<ShelvedChangeList> changeLists = ShelvedChangesViewManager.getShelvedLists(dataContext);
    if (changeLists.isEmpty())
        return;
    FileDocumentManager.getInstance().saveAllDocuments();
    if (changeLists.size() > 1) {
        unshelveMultipleShelveChangeLists(project, changeLists, getBinaryShelveChanges(dataContext), getShelveChanges(dataContext));
    } else {
        ShelvedChangeList changeList = changeLists.get(0);
        final VirtualFile virtualFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(new File(changeList.PATH));
        if (virtualFile == null) {
            VcsBalloonProblemNotifier.showOverChangesView(project, "Can not find path file", MessageType.ERROR);
            return;
        }
        List<ShelvedBinaryFilePatch> binaryShelvedPatches = ContainerUtil.map(changeList.getBinaryFiles(), ShelvedBinaryFilePatch::new);
        final ApplyPatchDifferentiatedDialog dialog = new MyUnshelveDialog(project, virtualFile, changeList, binaryShelvedPatches, e.getData(VcsDataKeys.CHANGES));
        dialog.setHelpId("reference.dialogs.vcs.unshelve");
        dialog.show();
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Project(com.intellij.openapi.project.Project) DataContext(com.intellij.openapi.actionSystem.DataContext) ApplyPatchDifferentiatedDialog(com.intellij.openapi.vcs.changes.patch.ApplyPatchDifferentiatedDialog) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File)

Aggregations

ApplyPatchDifferentiatedDialog (com.intellij.openapi.vcs.changes.patch.ApplyPatchDifferentiatedDialog)2 DataContext (com.intellij.openapi.actionSystem.DataContext)1 Project (com.intellij.openapi.project.Project)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 File (java.io.File)1 CalledInAwt (org.jetbrains.annotations.CalledInAwt)1