use of org.intellij.images.thumbnail.ThumbnailView in project intellij-community by JetBrains.
the class EnterAction method update.
public void update(AnActionEvent e) {
super.update(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.setVisible(false);
presentation.setEnabled(false);
}
}
}
Aggregations