Search in sources :

Example 1 with GitStashDialog

use of git4idea.ui.GitStashDialog in project intellij-community by JetBrains.

the class GitStash method perform.

/**
   * {@inheritDoc}
   */
protected void perform(@NotNull final Project project, @NotNull final List<VirtualFile> gitRoots, @NotNull final VirtualFile defaultRoot) {
    final ChangeListManager changeListManager = ChangeListManager.getInstance(project);
    if (changeListManager.isFreezedWithNotification("Can not stash changes now"))
        return;
    GitStashDialog d = new GitStashDialog(project, gitRoots, defaultRoot);
    if (!d.showAndGet()) {
        return;
    }
    VirtualFile root = d.getGitRoot();
    final GitLineHandler h = d.handler();
    AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
    try {
        GitHandlerUtil.doSynchronously(h, GitBundle.getString("stashing.title"), h.printableCommandLine());
    } finally {
        token.finish();
    }
    VfsUtil.markDirtyAndRefresh(false, true, false, root);
    if (!h.errors().isEmpty()) {
        showErrors(project, getActionName(), h.errors());
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) GitLineHandler(git4idea.commands.GitLineHandler) GitStashDialog(git4idea.ui.GitStashDialog) AccessToken(com.intellij.openapi.application.AccessToken) ChangeListManager(com.intellij.openapi.vcs.changes.ChangeListManager)

Aggregations

AccessToken (com.intellij.openapi.application.AccessToken)1 ChangeListManager (com.intellij.openapi.vcs.changes.ChangeListManager)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 GitLineHandler (git4idea.commands.GitLineHandler)1 GitStashDialog (git4idea.ui.GitStashDialog)1