CodeInsightActionHandler (@NotNull Editor editor, @NotNull PsiFile file) { Language language = PsiUtilCore.getLanguageAtOffset(file, editor.getCaretModel().getOffset()); final CodeInsightActionHandler codeInsightActionHandler = getLanguageExtension().forLanguage(language); if (codeInsightActionHandler != null) { if (codeInsightActionHandler instanceof LanguageCodeInsightActionHandler) { if (((LanguageCodeInsightActionHandler)codeInsightActionHandler).isValidFor(editor, file)) { return codeInsightActionHandler; } } else { return codeInsightActionHandler; } } return null; }