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; }