Search in sources :

Example 6 with FileHistoryUi

use of com.intellij.vcs.log.history.FileHistoryUi in project intellij-community by JetBrains.

the class CreatePatchFromHistoryAction method actionPerformed.

public void actionPerformed(@NotNull AnActionEvent e) {
    VcsLogUtil.triggerUsage(e);
    Project project = e.getRequiredData(CommonDataKeys.PROJECT);
    FileHistoryUi ui = e.getRequiredData(VcsLogInternalDataKeys.FILE_HISTORY_UI);
    String commitMessage = e.getRequiredData(VcsDataKeys.PRESET_COMMIT_MESSAGE);
    ui.getVcsLog().requestSelectedDetails(detailsList -> {
        List<Change> changes = ui.collectChanges(detailsList, false);
        CreatePatchFromChangesAction.createPatch(project, commitMessage, changes);
    }, null);
}
Also used : Project(com.intellij.openapi.project.Project) Change(com.intellij.openapi.vcs.changes.Change) FileHistoryUi(com.intellij.vcs.log.history.FileHistoryUi)

Example 7 with FileHistoryUi

use of com.intellij.vcs.log.history.FileHistoryUi in project intellij-community by JetBrains.

the class CreatePatchFromHistoryAction method update.

@Override
public void update(@NotNull AnActionEvent e) {
    Project project = e.getProject();
    FileHistoryUi ui = e.getData(VcsLogInternalDataKeys.FILE_HISTORY_UI);
    if (project == null || ui == null) {
        e.getPresentation().setEnabledAndVisible(false);
        return;
    }
    e.getPresentation().setVisible(true);
    List<CommitId> selectedCommits = ui.getVcsLog().getSelectedCommits();
    String commitMessage = e.getData(VcsDataKeys.PRESET_COMMIT_MESSAGE);
    e.getPresentation().setEnabled(!selectedCommits.isEmpty() && commitMessage != null);
}
Also used : Project(com.intellij.openapi.project.Project) CommitId(com.intellij.vcs.log.CommitId) FileHistoryUi(com.intellij.vcs.log.history.FileHistoryUi)

Aggregations

FileHistoryUi (com.intellij.vcs.log.history.FileHistoryUi)7 Project (com.intellij.openapi.project.Project)6 CommitId (com.intellij.vcs.log.CommitId)3 VcsFullCommitDetails (com.intellij.vcs.log.VcsFullCommitDetails)3 FilePath (com.intellij.openapi.vcs.FilePath)2 VcsFileRevision (com.intellij.openapi.vcs.history.VcsFileRevision)2 LoadingDetails (com.intellij.vcs.log.data.LoadingDetails)2 AnAction (com.intellij.openapi.actionSystem.AnAction)1 Change (com.intellij.openapi.vcs.changes.Change)1 ShowDiffContext (com.intellij.openapi.vcs.changes.actions.diff.ShowDiffContext)1 VcsLogUi (com.intellij.vcs.log.VcsLogUi)1 CompareRevisionsFromHistoryAction (com.intellij.vcs.log.ui.actions.history.CompareRevisionsFromHistoryAction)1 KeyEvent (java.awt.event.KeyEvent)1 MouseEvent (java.awt.event.MouseEvent)1 List (java.util.List)1