label.setCursor(Cursor.getDefaultCursor());
DefaultActionGroup actionGroup = new DefaultActionGroup();
for (T value : getValues()) {
actionGroup.add(new SelectValueAction(value));
}
ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(
null,
actionGroup,
DataManager.getInstance().getDataContext(this),
false,
false,
false,
new Runnable() {
@Override
public void run() {
isShowingPopup = false;
innerPanel.setBorder(defaultBorder);
innerPanel.setBackground(isComboBox ? COMBO_BOX_BACKGROUND : UIUtil.getPanelBackground());
innerPanel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
label.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
updateUI();
}
}, 10, new Condition<AnAction>() {
@Override
public boolean value(AnAction anAction) {
if (anAction instanceof ValueSelector.SelectValueAction) {
SelectValueAction action = (SelectValueAction) anAction;
return action.value.equals(selectedValue);
}
return false;
}
});
Point locationOnScreen = getLocationOnScreen();
Point location = new Point(
(int) (locationOnScreen.getX()),
(int) locationOnScreen.getY() + getHeight() + 1);
popup.showInScreenCoordinates(this, location);
isActive = true;
}