boolean (KeyEvent event) { if (ourPressed.first.get() && event.getWhen() - ourLastTimePressed.get() > 300) { resetState(); return false; } if (event.getID() == KeyEvent.KEY_PRESSED) { if (!ourPressed.first.get()) { resetState(); ourPressed.first.set(true); ourLastTimePressed.set(event.getWhen()); return false; } else { if (ourPressed.first.get() && ourReleased.first.get()) { ourPressed.second.set(true); ourLastTimePressed.set(event.getWhen()); return false; } } } else if (event.getID() == KeyEvent.KEY_RELEASED) { if (ourPressed.first.get() && !ourReleased.first.get()) { ourReleased.first.set(true); ourLastTimePressed.set(event.getWhen()); return false; } else if (ourPressed.first.get() && ourReleased.first.get() && ourPressed.second.get()) { resetState(); if (myActionKeyCode == -1 && !shouldSkipIfActionHasShortcut()) { if (!ClientId.isCurrentlyUnderLocalId()) { return false; } run(event); return true; } return false; } } resetState(); return false; }