void (@NotNull KeyEvent e) { if (!field.isPopupVisible()) { if (!isValid(customTemplateCallback)) { balloon.hide(); return; } switch (e.getKeyCode()) { case KeyEvent.VK_ENTER -> { final String abbreviation = field.getText(); if (validateTemplateKey(field, balloon, abbreviation, customTemplateCallback)) { myCallback.onEnter(abbreviation); PropertiesComponent.getInstance().setValue(myLastAbbreviationKey, abbreviation); field.addCurrentTextToHistory(); balloon.hide(); } } case KeyEvent.VK_ESCAPE -> balloon.hide(false); } } }