void (@NotNull AnActionEvent e) { Project project = e.getProject(); VirtualFile file = e.getData(CommonDataKeys.VIRTUAL_FILE); boolean image = file != null && ImageFileTypeManager.getInstance().isImage(file); boolean visible = !ActionPlaces.isPopupPlace(e.getPlace()) || image; e.getPresentation().setEnabled(project != null); e.getPresentation().setVisible(visible); }