private void applyNewState(@NotNull List<Bookmark> newList, boolean fireEvents) {
    if (!myBookmarks.isEmpty()) {
      Bookmark[] bookmarks = myBookmarks.values().toArray(new Bookmark[0]);
      for (Bookmark bookmark : bookmarks) {
        bookmark.release();
      }
      myBookmarks.clear();
    }

    int bookmarkIndex = newList.size() - 1;
    List<Bookmark> addedBookmarks = new ArrayList<>(newList.size());
    for (Bookmark bookmark : newList) {
      OpenFileDescriptor target = bookmark.init(myProject);
      if (target == null) {
        continue;
      }

      if (target.getLine() == -1 && findFileBookmark(target.getFile()) != null) {
        continue;
      }

      bookmark.index = bookmarkIndex--;

      char mnemonic = bookmark.getMnemonic();
      if (mnemonic != Character.MIN_VALUE ) {
        Bookmark old = findBookmarkForMnemonic(mnemonic);
        if (old != null) {
          removeBookmark(old);
        }
      }

      myBookmarks.putValue(target.getFile(), bookmark);
      addedBookmarks.add(bookmark);
    }

    if (fireEvents) {
      for (Bookmark bookmark : addedBookmarks) {
        getPublisher().bookmarkAdded(bookmark);
      }
    }
  }
private void applyNewState(@NotNull List<Bookmark> newList, boolean fireEvents)