protected override void CommandAction(DTEHelper helper, Tuple <string, string[]> schemas) { var listFiles = helper.GetSelectedFilesInSolutionExplorer(FileOperations.SupportsXmlType, false); if (listFiles.Any()) { foreach (var document in listFiles.Where(s => s.Document != null && s.Document.ActiveWindow != null && s.Document.ActiveWindow.Visible).Select(s => s.Document)) { ContentCoparerHelper.ReplaceXsdSchemaInDocument(document, schemas.Item2); } foreach (var filePath in listFiles.Where(s => !(s.Document != null && s.Document.ActiveWindow != null && s.Document.ActiveWindow.Visible)).Select(s => s.FilePath)) { ContentCoparerHelper.ReplaceXsdSchemaInFile(filePath, schemas.Item2); } } }