void (@NotNull AnActionEvent e) { VirtualFile myFile = e.getData(CommonDataKeys.VIRTUAL_FILE); boolean enabled = myFile != null && checkEnabled(myFile); e.getPresentation().setEnabled(enabled); e.getPresentation().setVisible(myFile != null); }