Search in sources :

Example 1 with RelocateDialog

use of org.jetbrains.idea.svn.dialogs.RelocateDialog in project intellij-community by JetBrains.

the class RelocateAction method perform.

@Override
protected void perform(@NotNull SvnVcs vcs, @NotNull VirtualFile file, @NotNull DataContext context) throws VcsException {
    Info info = vcs.getInfo(file);
    assert info != null;
    RelocateDialog dlg = new RelocateDialog(vcs.getProject(), info.getURL());
    if (!dlg.showAndGet()) {
        return;
    }
    String beforeURL = dlg.getBeforeURL();
    String afterURL = dlg.getAfterURL();
    if (beforeURL.equals(afterURL))
        return;
    ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> {
        ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
        if (indicator != null) {
            indicator.setIndeterminate(true);
        }
        try {
            File path = VfsUtilCore.virtualToIoFile(file);
            vcs.getFactory(path).createRelocateClient().relocate(path, beforeURL, afterURL);
            VcsDirtyScopeManager.getInstance(vcs.getProject()).markEverythingDirty();
        } catch (VcsException e) {
            runOrInvokeLaterAboveProgress(() -> Messages.showErrorDialog(vcs.getProject(), "Error relocating working copy: " + e.getMessage(), "Relocate Working Copy"), null, vcs.getProject());
        }
    }, "Relocating Working Copy", false, vcs.getProject());
}
Also used : RelocateDialog(org.jetbrains.idea.svn.dialogs.RelocateDialog) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) VcsException(com.intellij.openapi.vcs.VcsException) Info(org.jetbrains.idea.svn.info.Info) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File)

Aggregations

ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1 VcsException (com.intellij.openapi.vcs.VcsException)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 File (java.io.File)1 RelocateDialog (org.jetbrains.idea.svn.dialogs.RelocateDialog)1 Info (org.jetbrains.idea.svn.info.Info)1