use of com.oxygenxml.git.view.history.actions.CreateBranchFromCommitAction in project oxygen-git-client-addon by oxygenxml.
the class HistoryViewContextualMenuPresenter method populateActions4SingleSelection.
/**
* Contributes the contextual actions for the given file, at the given revision/commit.
*
* @param jPopupMenu Contextual menu in which to put the actions.
* @param filePath File path.
* @param commitCharacteristics Revision/commit data.
*
* @throws IOException If it fails.
* @throws GitAPIException If it fails.
*/
private void populateActions4SingleSelection(JPopupMenu jPopupMenu, String filePath, CommitCharacteristics commitCharacteristics) throws IOException, GitAPIException {
if (filePath != null) {
Optional<FileStatus> fileStatusOptional = getFileStatus(filePath, commitCharacteristics);
fileStatusOptional.ifPresent(fileStatus -> populateContextActionsForFile(jPopupMenu, fileStatus, commitCharacteristics, true));
}
if (filePath != null) {
jPopupMenu.addSeparator();
}
String commitId = commitCharacteristics.getCommitId();
if (!GitAccess.UNCOMMITED_CHANGES.getCommitId().equals(commitId)) {
jPopupMenu.add(new CreateBranchFromCommitAction(commitId));
jPopupMenu.add(new CreateTagAction(commitId));
jPopupMenu.add(new CheckoutCommitAction(commitCharacteristics.getPlotCommit()));
jPopupMenu.addSeparator();
jPopupMenu.add(new RevertCommitAction(commitCharacteristics));
jPopupMenu.add(new ResetBranchToCommitAction(commitCharacteristics));
}
}
Aggregations