void (@NotNull FileSystemTree fileSystemTree, @NotNull AnActionEvent e) { Presentation presentation = e.getPresentation(); FileType fileType = e.getData(FileChooserKeys.NEW_FILE_TYPE); String initialContent = e.getData(FileChooserKeys.NEW_FILE_TEMPLATE_TEXT); if (fileType != null && initialContent != null) { presentation.setVisible(true); VirtualFile selectedFile = fileSystemTree.getNewFileParent(); presentation.setEnabled(selectedFile != null && selectedFile.isDirectory()); presentation.setIcon(LayeredIcon.create(fileType.getIcon(), AllIcons.Actions.New)); } else { presentation.setEnabledAndVisible(false); } }