use of com.oxygenxml.git.view.event.PullType in project oxygen-git-client-addon by oxygenxml.
the class ToolbarPanel method addPullActionsToMenu.
/**
* Add the pull actions (pull + merge, pull + rebase, etc) to the pull menu.
*
* @param splitMenuButton The menu button to add to.
*/
private void addPullActionsToMenu(SplitMenuButton splitMenuButton) {
ButtonGroup pullActionsGroup = new ButtonGroup();
ActionListener radioMenuItemActionListener = e -> {
if (e.getSource() instanceof JMenuItem) {
splitMenuButton.setAction(((JMenuItem) e.getSource()).getAction());
}
};
// Pull (merge)
final JRadioButtonMenuItem pullMergeMenuItem = new JRadioButtonMenuItem(gitActionsManager.getPullMergeAction());
pullMergeMenuItem.addActionListener(radioMenuItemActionListener);
splitMenuButton.add(pullMergeMenuItem);
pullActionsGroup.add(pullMergeMenuItem);
// Pull (rebase)
final JRadioButtonMenuItem pullRebaseMenuItem = new JRadioButtonMenuItem(gitActionsManager.getPullRebaseAction());
pullRebaseMenuItem.addActionListener(radioMenuItemActionListener);
splitMenuButton.add(pullRebaseMenuItem);
pullActionsGroup.add(pullRebaseMenuItem);
PullType defaultPullType = OptionsManager.getInstance().getDefaultPullType();
if (defaultPullType == PullType.REBASE) {
splitMenuButton.setAction(pullRebaseMenuItem.getAction());
pullRebaseMenuItem.setSelected(true);
} else if (defaultPullType != PullType.UKNOWN) {
splitMenuButton.setAction(pullMergeMenuItem.getAction());
pullMergeMenuItem.setSelected(true);
}
}
use of com.oxygenxml.git.view.event.PullType in project oxygen-git-client-addon by oxygenxml.
the class ToolbarPanel method getPullFromTranslationTag.
/**
* @return The translation tag for the "Pull" button tooltip text.
*/
private String getPullFromTranslationTag() {
String pullFromTag = Tags.PULL_FROM;
Object value = pullMenuButton.getAction().getValue(PullAction.PULL_TYPE_ACTION_PROP);
if (value instanceof PullType) {
PullType pt = (PullType) value;
if (pt == PullType.REBASE) {
pullFromTag = Tags.PULL_REBASE_FROM;
} else if (pt != PullType.UKNOWN) {
pullFromTag = Tags.PULL_MERGE_FROM;
}
}
return pullFromTag;
}
Aggregations