use of com.oxygenxml.git.view.history.HistoryViewContextualMenuPresenter in project oxygen-git-client-addon by oxygenxml.
the class HistoryPanelTestBase method getCompareWithWCAction.
/**
* Computes the contextual action over the given file.
* Returns the "Compare_file_with_working_tree_version" action available when you select 2 revisions.
*
* @param fileStatus File information for which we want the action.
* @param cc Revision information.
*
* @return The action. If not found, an assert will fail.
*
* @throws IOException If it fails.
* @throws GitAPIException If it fails.
*/
protected Action getCompareWithWCAction(FileStatus fileStatus, CommitCharacteristics cc) throws IOException, GitAPIException {
HistoryViewContextualMenuPresenter menuPresenter = new HistoryViewContextualMenuPresenter(PowerMockito.mock(GitControllerBase.class));
JPopupMenu jPopupMenu = new JPopupMenu();
menuPresenter.populateContextualActionsHistoryContext(jPopupMenu, fileStatus.getFileLocation(), cc);
MenuElement[] subElements = jPopupMenu.getSubElements();
List<Action> actions = Arrays.asList(subElements).stream().map(t -> ((JMenuItem) t).getAction()).filter(t -> ((String) t.getValue(Action.NAME)).startsWith("Compare_file_with_working_tree_version")).collect(Collectors.toList());
assertFalse("Unable to find the 'Compare_with_working_tree_version' action.", actions.isEmpty());
return actions.get(0);
}
use of com.oxygenxml.git.view.history.HistoryViewContextualMenuPresenter in project oxygen-git-client-addon by oxygenxml.
the class HistoryPanelTestBase method getCompareWithPreviousAction.
/**
* Computes the contextual action over the given file.
* Returns the "Compare with each other" action available when you select 2 revisions.
*
* @param fileStatus File information for which we want the action.
* @param cc Revision information.
*
* @return The action. If not found, an assert will fail.
*
* @throws IOException If it fails.
* @throws GitAPIException If it fails.
*/
protected Action getCompareWithPreviousAction(FileStatus fileStatus, CommitCharacteristics cc) throws IOException, GitAPIException {
HistoryViewContextualMenuPresenter menuPresenter = new HistoryViewContextualMenuPresenter(PowerMockito.mock(GitControllerBase.class));
JPopupMenu jPopupMenu = new JPopupMenu();
menuPresenter.populateContextualActionsHistoryContext(jPopupMenu, fileStatus.getFileLocation(), cc);
MenuElement[] subElements = jPopupMenu.getSubElements();
List<Action> actions = Arrays.asList(subElements).stream().map(t -> ((JMenuItem) t).getAction()).filter(t -> ((String) t.getValue(Action.NAME)).startsWith("Compare_file_with_previous_")).collect(Collectors.toList());
assertFalse("Unable to find the 'Compare with previous version' action.", actions.isEmpty());
return actions.get(0);
}
use of com.oxygenxml.git.view.history.HistoryViewContextualMenuPresenter in project oxygen-git-client-addon by oxygenxml.
the class HistoryPanelTestBase method getCompareWithEachOther.
/**
* Computes the contextual action over the given file.
* Returns the "Compare with each other" action available when you select 2 revisions.
*
* @param fileStatus File informations for which we want the action.
* @param cc Revision information.
*
* @return The action. If not found, an assert will fail.
*
* @throws IOException If it fails.
* @throws GitAPIException If it fails.
*/
protected Action getCompareWithEachOther(FileStatus fileStatus, CommitCharacteristics... cc) throws IOException, GitAPIException {
HistoryViewContextualMenuPresenter menuPresenter = new HistoryViewContextualMenuPresenter(PowerMockito.mock(GitControllerBase.class));
JPopupMenu jPopupMenu = new JPopupMenu();
menuPresenter.populateContextualActionsHistoryContext(jPopupMenu, fileStatus.getFileLocation(), cc);
MenuElement[] subElements = jPopupMenu.getSubElements();
List<Action> actions = Arrays.asList(subElements).stream().map(t -> ((JMenuItem) t).getAction()).filter(t -> ((String) t.getValue(Action.NAME)).startsWith("Compare_with_each_other")).collect(Collectors.toList());
assertFalse("Unable to find the 'Compare_with_each_other' action.", actions.isEmpty());
return actions.get(0);
}
Aggregations