button.setCommandButtonKind(CommandButtonKind.POPUP_ONLY);
button.setPopupCallback(new PopupPanelCallback() {
public JPopupPanel getPopupPanel(JCommandButton commandButton) {
JCommandPopupMenu popupmenu = new JCommandPopupMenu();
final AFreeplaneAction toggleFBarAction = context.getBuilder().getMode().getAction("ToggleFBarAction");
final JCommandToggleMenuButton toggleFBarButton = RibbonActionContributorFactory.createCommandToggleMenuButton(toggleFBarAction);
toggleFBarAction.setSelected();
toggleFBarButton.getActionModel().setSelected(toggleFBarAction.isSelected());
popupmenu.addMenuButton(toggleFBarButton);
final AFreeplaneAction toggleLeftToolbarAction = context.getBuilder().getMode().getAction("ToggleLeftToolbarAction");
final JCommandToggleMenuButton toggleLeftToolbarButton = RibbonActionContributorFactory.createCommandToggleMenuButton(toggleLeftToolbarAction);
toggleLeftToolbarAction.setSelected();
toggleLeftToolbarButton.getActionModel().setSelected(toggleLeftToolbarAction.isSelected());
popupmenu.addMenuButton(toggleLeftToolbarButton);
final AFreeplaneAction toggleStatusAction = context.getBuilder().getMode().getAction("ToggleStatusAction");
final JCommandToggleMenuButton toggleStatusButton = RibbonActionContributorFactory.createCommandToggleMenuButton(toggleStatusAction);
toggleStatusAction.setSelected();
toggleStatusButton.getActionModel().setSelected(toggleStatusAction.isSelected());
popupmenu.addMenuButton(toggleStatusButton);
final AFreeplaneAction toggleScrollbarsAction = context.getBuilder().getMode().getAction("ToggleScrollbarsAction");
final JCommandToggleMenuButton toggleScrollbarsButton = RibbonActionContributorFactory.createCommandToggleMenuButton(toggleScrollbarsAction);
toggleScrollbarsAction.setSelected();
toggleScrollbarsButton.getActionModel().setSelected(toggleScrollbarsAction.isSelected());
popupmenu.addMenuButton(toggleScrollbarsButton);
return popupmenu;
}
});
band.addCommandButton(button, RibbonElementPriority.MEDIUM);
AFreeplaneAction action = context.getBuilder().getMode().getAction("SetShortenerStateAction");
button = RibbonActionContributorFactory.createCommandButton(action);
band.addCommandButton(button, RibbonElementPriority.MEDIUM);
action = context.getBuilder().getMode().getAction("ToggleDetailsAction");
button = RibbonActionContributorFactory.createCommandButton(action);
band.addCommandButton(button, RibbonElementPriority.MEDIUM);
}
private void createToolTipMenu(final RibbonBuildContext context, final JRibbonBand band) {
JCommandButton button = new JCommandButton(TextUtils.removeTranslateComment(TextUtils.getText("menu_hoverView")));
button.setCommandButtonKind(CommandButtonKind.POPUP_ONLY);
button.setPopupCallback(new PopupPanelCallback() {
public JPopupPanel getPopupPanel(JCommandButton commandButton) {
JCommandPopupMenu popupmenu = new JCommandPopupMenu();
final SetBooleanPropertyAction showAction = (SetBooleanPropertyAction) context.getBuilder().getMode().getAction("SetBooleanPropertyAction.show_node_tooltips");
final JCommandToggleMenuButton showButton = RibbonActionContributorFactory.createCommandToggleMenuButton(showAction);
showAction.setSelected();
showButton.getActionModel().setSelected(showAction.isSelected());
popupmenu.addMenuButton(showButton);
final SetBooleanPropertyAction showStylesAction = (SetBooleanPropertyAction) context.getBuilder().getMode().getAction("SetBooleanPropertyAction.show_styles_in_tooltip");
final JCommandToggleMenuButton showStylesButton = RibbonActionContributorFactory.createCommandToggleMenuButton(showStylesAction);
showStylesAction.setSelected();
showStylesButton.getActionModel().setSelected(showStylesAction.isSelected());
popupmenu.addMenuButton(showStylesButton);
final AFreeplaneAction modificationAction = context.getBuilder().getMode().getAction("CreationModificationPluginAction");
final JCommandToggleMenuButton modificationButton = RibbonActionContributorFactory.createCommandToggleMenuButton(modificationAction);
modificationAction.setSelected();
modificationButton.getActionModel().setSelected(modificationAction.isSelected());
popupmenu.addMenuButton(modificationButton);
return popupmenu;
}
});