List of usage examples for com.intellij.openapi.ui.popup ListPopupStep isSelectable
boolean isSelectable(T value);
From source file:com.intellij.ui.popup.list.ListPopupImpl.java
License:Apache License
private boolean _handleSelect(final boolean handleFinalChoices, InputEvent e) { if (myList.getSelectedIndex() == -1) return false; if (getSpeedSearch().isHoldingFilter() && myList.getModel().getSize() == 0) return false; if (myList.getSelectedIndex() == getIndexForShowingChild()) { if (myChild != null && !myChild.isVisible()) setIndexForShowingChild(-1); return false; }/*w w w . j a va 2 s . c o m*/ final Object[] selectedValues = myList.getSelectedValues(); final ListPopupStep<Object> listStep = getListStep(); if (!listStep.isSelectable(selectedValues[0])) return false; if ((listStep instanceof MultiSelectionListPopupStep<?> && !((MultiSelectionListPopupStep<Object>) listStep).hasSubstep(Arrays.asList(selectedValues)) || !listStep.hasSubstep(selectedValues[0])) && !handleFinalChoices) return false; disposeChildren(); if (myListModel.getSize() == 0) { setFinalRunnable(myStep.getFinalRunnable()); setOk(true); disposeAllParents(e); setIndexForShowingChild(-1); return true; } valuesSelected(selectedValues); final PopupStep nextStep = listStep instanceof MultiSelectionListPopupStep<?> ? ((MultiSelectionListPopupStep<Object>) listStep).onChosen(Arrays.asList(selectedValues), handleFinalChoices) : listStep.onChosen(selectedValues[0], handleFinalChoices); return handleNextStep(nextStep, selectedValues.length == 1 ? selectedValues[0] : null, e); }
From source file:com.intellij.ui.popup.list.ListPopupImpl.java
License:Apache License
protected boolean handleFinalChoices(MouseEvent e, Object selectedValue, ListPopupStep<Object> listStep) { return selectedValue == null || !listStep.hasSubstep(selectedValue) || !listStep.isSelectable(selectedValue) || !isOnNextStepButton(e);//from w w w. j a v a 2s.c o m }
From source file:com.intellij.ui.popup.list.PopupListElementRenderer.java
License:Apache License
@Override protected void customizeComponent(JList list, Object value, boolean isSelected) { ListPopupStep<Object> step = myPopup.getListStep(); boolean isSelectable = step.isSelectable(value); myTextLabel.setEnabled(isSelectable); if (step.isMnemonicsNavigationEnabled()) { final int pos = step.getMnemonicNavigationFilter().getMnemonicPos(value); if (pos != -1) { String text = myTextLabel.getText(); text = text.substring(0, pos) + text.substring(pos + 1); myTextLabel.setText(text);//from w ww . j a v a2 s.co m myTextLabel.setDisplayedMnemonicIndex(pos); } } else { myTextLabel.setDisplayedMnemonicIndex(-1); } if (step.hasSubstep(value) && isSelectable) { myNextStepLabel.setVisible(true); final boolean isDark = ColorUtil.isDark(UIUtil.getListSelectionBackground()); myNextStepLabel .setIcon(isSelected ? isDark ? AllIcons.Icons.Ide.NextStepInverted : AllIcons.Icons.Ide.NextStep : AllIcons.Icons.Ide.NextStepGrayed); } else { myNextStepLabel.setVisible(false); //myNextStepLabel.setIcon(PopupIcons.EMPTY_ICON); } if (isSelected) { setSelected(myNextStepLabel); } else { setDeselected(myNextStepLabel); } }