void (final Color color, final Object source) { Runnable apply = () -> CommandProcessor.getInstance().executeCommand(project, () -> listener.colorChanged(color, source), IdeBundle.message("command.name.apply.color"), groupId); alarm.cancelAllRequests(); Runnable request = () -> ApplicationManager.getApplication().invokeLaterOnWriteThread(apply); if (source instanceof ColorPipetteButton && ((ColorPipetteButton)source).getCurrentState() == ColorPipetteButton.PipetteState.UPDATING) { alarm.addRequest(request, 150); } else { request.run(); } }