void (@NotNull AnActionEvent e) { boolean hasSpeedSearch = e.getData(PlatformDataKeys.SPEED_SEARCH_TEXT) != null; SmartSelectProvider provider = hasSpeedSearch ? null : getProvider(e.getDataContext()); if (provider != null) { Object source = provider.getSource(e.getDataContext()); //noinspection unchecked if ( (isIncreasing() && provider.canIncreaseSelection(source)) || (!isIncreasing() && provider.canDecreaseSelection(source))) { e.getPresentation().setEnabled(true); return; } } e.getPresentation().setEnabled(false); }