LocalChangeList addChangeList(
      String id,
      @NotNull final String name,
      @Nullable final String description,
      final boolean inUpdate,
      @Nullable Object data) {
    final boolean contains = myMap.containsKey(name);
    LOG.assertTrue(!contains, "Attempt to create duplicate changelist " + name);
    final LocalChangeListImpl newList =
        (LocalChangeListImpl) LocalChangeList.createEmptyChangeList(myProject, name);
    newList.setData(data);

    if (description != null) {
      newList.setCommentImpl(description);
    }
    if (id != null) {
      newList.setId(id);
    }
    myMap.put(name, newList);
    if (inUpdate) {
      // scope is not important: nothing had been added jet, nothing to move to "old state" members
      newList.startProcessingChanges(
          myProject, null); // this is executed only when use through GATE
    }
    return newList.copy();
  }
 public boolean editName(@NotNull final String fromName, @NotNull final String toName) {
   if (fromName.equals(toName)) return false;
   final LocalChangeList list = myMap.get(fromName);
   final boolean canEdit = list != null && (!list.isReadOnly());
   if (canEdit) {
     final LocalChangeListImpl listImpl = (LocalChangeListImpl) list;
     listImpl.setNameImpl(toName);
     myMap.remove(fromName);
     myMap.put(toName, list);
     final ChangeListEditHandler editHandler = listImpl.getEditHandler();
     if (editHandler != null) {
       listImpl.setCommentImpl(
           editHandler.changeCommentOnChangeName(toName, listImpl.getComment()));
     }
   }
   return canEdit;
 }
 @Nullable
 public String editComment(@NotNull final String fromName, final String newComment) {
   final LocalChangeList list = myMap.get(fromName);
   if (list != null) {
     final String oldComment = list.getComment();
     if (!Comparing.equal(oldComment, newComment)) {
       final LocalChangeListImpl listImpl = (LocalChangeListImpl) list;
       listImpl.setCommentImpl(newComment);
       final ChangeListEditHandler editHandler = listImpl.getEditHandler();
       if (editHandler != null) {
         listImpl.setNameImpl(
             editHandler.changeNameOnChangeComment(listImpl.getName(), listImpl.getComment()));
         if (!fromName.equals(listImpl.getName())) {
           myMap.remove(fromName);
           myMap.put(listImpl.getName(), list);
         }
       }
     }
     return oldComment;
   }
   return null;
 }