コード例 #1
0
 private void DispatchLoadToExtensions()
 {
     if (Hierarchy != null)
     {
         var projectItem = VsUtils.GetProjectItem(Hierarchy, ItemId);
         if (projectItem != null)
         {
             var    fileContents = VSHelpers.GetTextFromVsTextLines(VsBuffer);
             string newBufferContents;
             List <ExtensionError> extensionErrors;
             if (StandaloneXmlModelProvider.TryGetBufferViaExtensions(
                     projectItem, fileContents, out newBufferContents, out extensionErrors))
             {
                 if (VSHelpers.CheckOutFilesIfEditable(ServiceProvider, new[] { FileName }))
                 {
                     VsUtils.SetTextForVsTextLines(VsBuffer, newBufferContents);
                 }
                 else
                 {
                     ErrorListHelper.LogExtensionErrors(
                         new List <ExtensionError>
                     {
                         new ExtensionError(
                             string.Format(
                                 CultureInfo.CurrentCulture, Resources.ExtensionError_SourceControlLock,
                                 Path.GetFileName(FileName)),
                             ErrorCodes.ExtensionsError_BufferNotEditable,
                             ExtensionErrorSeverity.Error)
                     },
                         projectItem);
                 }
             }
         }
     }
 }