boolean (@NotNull KeyEvent event) { int keyCode = event.getKeyCode(); LOG.debug("", this, event); if (keyCode == myModifierKeyCode) { if (hasOtherModifiers(event)) { resetState(); return false; } if (myActionKeyCode == -1 && ourOtherKeyWasPressed.get() && event.getWhen() - ourLastTimePressed.get() < 100) { resetState(); return false; } ourOtherKeyWasPressed.set(false); if (ourPressed.first.get() && event.getWhen() - ourLastTimePressed.get() > 500) { resetState(); } return handleModifier(event); } else if (ourPressed.first.get() && ourReleased.first.get() && ourPressed.second.get() && myActionKeyCode != -1) { if (keyCode == myActionKeyCode && !hasOtherModifiers(event)) { if (event.getID() == KeyEvent.KEY_PRESSED) { return run(event); } return true; } return false; } else { ourLastTimePressed.set(event.getWhen()); ourOtherKeyWasPressed.set(true); if (keyCode == KeyEvent.VK_ESCAPE || keyCode == KeyEvent.VK_TAB) { ourLastTimePressed.set(0); } } resetState(); return false; }