void (@NotNull AnActionEvent e) { Project project = e.getData(CommonDataKeys.PROJECT); if (e.getData(GroupItem.DATA_KEY) != null || e.getData(ComponentItem.DATA_KEY) != null) { e.getPresentation().setVisible(true); GroupItem groupItem = e.getData(GroupItem.DATA_KEY); e.getPresentation().setEnabled(project != null && (groupItem == null || !groupItem.isReadOnly())); } else { PsiFile psiFile = e.getData(CommonDataKeys.PSI_FILE); e.getPresentation().setVisible(psiFile != null && findElementToAdd(psiFile) != null); } }