void (@NotNull AnActionEvent e) { if (ThumbnailViewActionUtil.setEnabled(e)) { Presentation presentation = e.getPresentation(); ThumbnailView view = ThumbnailViewActionUtil.getVisibleThumbnailView(e); VirtualFile[] selection = view.getSelection(); if (selection.length > 0) { if (selection.length == 1 && selection[0].isDirectory()) { presentation.setVisible(true); } else { boolean notImages = false; ImageFileTypeManager typeManager = ImageFileTypeManager.getInstance(); for (VirtualFile file : selection) { notImages |= !typeManager.isImage(file); } presentation.setEnabled(!notImages); presentation.setVisible(false); } } else { presentation.setEnabledAndVisible(false); } } }