void (@NotNull AnActionEvent e) { super.update(e); String text = ActionsBundle.message("action.compare.files.text"); VirtualFile[] files = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY); if (files != null) { if (files.length == 1) { text = ActionsBundle.message("action.compare.with.text"); } else if (files.length == 2 || files.length == 3) { Set<Type> types = ContainerUtil.map2Set(files, CompareFilesAction::getType); if (types.size() != 1) { text = ActionsBundle.message("action.compare.text"); } else { text = ActionsBundle.message(switch (types.iterator().next()) { case FILE -> "action.compare.files.text"; case DIRECTORY -> "action.CompareDirs.text"; case ARCHIVE -> "action.compare.archives.text"; }); } } } e.getPresentation().setText(text); }