void OnBufferActivated( SCNotification *notifyCode )
  {
    auto loadedBplist = g_pLoadedBplists->find( notifyCode->nmhdr.idFrom );

    if ( loadedBplist == g_pLoadedBplists->end() )
    {
      // Get the current scintilla

      HWND hSkilla;
      CharVt rawBuff = ReadFromSkintilla( hSkilla );

      // not a bplist file
      if ( !IsValidBplist( rawBuff ) )
      {
        return;
      }

      PlistEntryPtr plistEntry = MAKE_PLIST_PTR();

      // get converted text to display
      auto XMLVt = plistEntry->GetXML( std::move( rawBuff ) );
      InsertDataIntoSkilla( hSkilla, XMLVt.data(), XMLVt.size() );

      g_pLoadedBplists->insert( std::make_pair( notifyCode->nmhdr.idFrom, std::move( plistEntry ) ) );

      MarkDocumentIsUnmodified( hSkilla );
    }
  }
  void OnBufferActivated( SCNotification *notifyCode )
  {
    int which = -1;
    ::SendMessage(nppData._nppHandle, NPPM_GETCURRENTSCINTILLA, 0, (LPARAM)&which);
    if (which == -1)
      return;
    HWND hCurrentEditView = (which == 0) ? nppData._scintillaMainHandle : nppData._scintillaSecondHandle;




    int cbText = ::SendMessage(hCurrentEditView, SCI_GETLENGTH, NULL, NULL);

    auto loadedBplist = g_pLoadedBplists->find( notifyCode->nmhdr.idFrom );

    if ( loadedBplist == g_pLoadedBplists->end() )
    {
      // Get the current scintilla

      HWND hSkilla;
      CharVt rawBuff = ReadFromSkintilla( hSkilla );

      // not a bplist file
      if ( !IsValidBplist( rawBuff ) )
      {
        return;
      }

      PlistEntryPtr plistEntry = MAKE_PLIST_PTR();

      // get converted text to display
      auto XMLVt = plistEntry->GetXML( std::move( rawBuff ) );
      InsertDataIntoSkilla( hSkilla, XMLVt.data(), XMLVt.size() );

      g_pLoadedBplists->insert( std::make_pair( notifyCode->nmhdr.idFrom, std::move( plistEntry ) ) );

      MarkDocumentIsUnmodified( hSkilla );
    }
  }
  //
  // Raw bplist data was saved, so now lets return friendly xml plist data to notepad++
  //
  void OnFileSaved( SCNotification *notifyCode )
  {
    auto loadedBplist = g_pLoadedBplists->find( notifyCode->nmhdr.idFrom );

    if ( loadedBplist != g_pLoadedBplists->end() &&
         loadedBplist->second->GetContentType() != ContentType::corrupted ) // check that file was saved properly
    {
      // Get the current scintilla
      HWND hSkilla;
      CharVt rawBuff = ReadFromSkintilla( hSkilla );

      // not a bplist file
      if ( !IsValidBplist( rawBuff ) )
      {
        return;
      }

      // get converted text to display
      auto XMLVt = loadedBplist->second->GetXML( std::move( rawBuff ) );
      InsertDataIntoSkilla( hSkilla, XMLVt.data(), XMLVt.size() );

      MarkDocumentIsUnmodified(hSkilla);
    }
  }