void (@NotNull AnActionEvent e) { e.getPresentation().setEnabled(false); e.getPresentation().setIcon(AllIcons.Actions.Preview); final Project project = e.getData(CommonDataKeys.PROJECT); if (project != null) { final PsiElement psiElement = getPsiElement(e.getDataContext(), project, e.getData(CommonDataKeys.EDITOR)); if (psiElement != null) { if (psiElement.getContainingFile() instanceof PsiClassOwner) { e.getPresentation().setEnabled(true); } } } }