@Override public final void actionPerformed(final ActionEvent e) { boolean selected = !isSelected(e); setSelected(e, selected); e.getPresentation() .firePropertyChange( SELECTED_PROPERTY, Boolean.valueOf(!selected), Boolean.valueOf(selected)); }
/** @return true when at list one item from list of menu items has selected state. */ private boolean hasCheckedItems() { return list.stream() .filter(action -> action instanceof ToggleAction) .map(action -> (ToggleAction) action) .anyMatch( action -> action.isSelected( new ActionEvent(presentationFactory.getPresentation(action), actionManager))); }
new ActionEvent(presentationFactory.getPresentation(toggleAction), actionManager); if (toggleAction.isSelected(e)) {