void (@NotNull AnActionEvent e) { RunContentDescriptor descriptor = LangDataKeys.RUN_CONTENT_DESCRIPTOR.getData(myDataContext); boolean visible = false; if (descriptor != null) { for (AnAction action : descriptor.getRestartActions()) { if (action instanceof ToggleAutoTestAction) { visible = ((ToggleAutoTestAction)action).isDelayApplicable(); break; } } } e.getPresentation().setVisible(visible); }