String (VirtualFile[] files) { if (files == null || files.length == 0) { return null; } String fromWhere = null; for (VirtualFile file : files) { if (file.isDirectory()) { // Accurate calculation is very costly especially in presence of excluded directories! fromWhere = "all files in '" + file.getName() + "' directory (recursively)" + (files.length == 1 ? "" : " and others"); break; } else if (file.getBOM() != null) { fromWhere = file.getName() + (files.length == 1 ? "" : " and others"); break; } } return fromWhere; }