private void FormatAllSelectedDocuments(CommandUILocation commandUILocation) { foreach (var item in CollectItems(true, ScriptConstants.kAcceptedFileExtensions, commandUILocation)) { var document = (item.GetObject() as ProjectItem).Document; if (null == document) { document = DocumentsHandler.GetActiveDocument(); } mClangFormatView = SettingsProvider.ClangFormatSettings; mDocument = document; RunClangFormat(commandUILocation); } }
private void FormatAllSelectedDocuments() { foreach (var item in CollectSelectedItems(true)) { var document = (item.GetObject() as ProjectItem).Document; if (null == document) { document = DocumentsHandler.GetActiveDocument(); } mClangFormatView = GetUserOptions(); mDocument = document; RunClangFormat(new object(), new EventArgs()); } }
private void FormatAllSelectedDocuments() { foreach (var item in CollectSelectedItems(true)) { var document = (item.GetObject() as ProjectItem).Document; if (null == document) { document = DocumentsHandler.GetActiveDocument(); } mClangFormatView = SettingsProvider.GetSettingsPage(typeof(ClangFormatOptionsView)) as ClangFormatOptionsView; mDocument = document; RunClangFormat(); } }
private void FormatAllSelectedDocuments() { ItemsCollector itemsCollector = new ItemsCollector(); itemsCollector.CollectSelectedProjectItems(); List <Document> activeDocs = DocumentsHandler.GetListOfActiveDocuments(); Document activeDocument = DocumentsHandler.GetActiveDocument(); foreach (var item in itemsCollector.items) { try { var projectItem = item.GetObject() as ProjectItem; mDocument = projectItem.Open().Document; ExecuteFormatCommand(); if (DocumentsHandler.IsOpen(mDocument, activeDocs)) { mDocument.Save(); } else { mDocument.Close(vsSaveChanges.vsSaveChangesYes); } } catch (Exception) { } finally { mDocument = null; } } if (activeDocument != null) { activeDocument.Activate(); } }