From d7e65b11e3d54e57d0ce8d85f7681305cb473b60 Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Wed, 7 Dec 2016 14:28:39 +0300 Subject: [PATCH] vcs: cleanup - remove duplicating setters --- .../openapi/vcs/changes/ChangeListWorker.java | 6 ++-- .../vcs/changes/LocalChangeListImpl.java | 30 +++++-------------- 2 files changed, 11 insertions(+), 25 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListWorker.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListWorker.java index 6b3c26b46544..1ca77e54f7b1 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListWorker.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListWorker.java @@ -209,7 +209,7 @@ public class ChangeListWorker implements ChangeListsWriteOperations { newList.setData(data); if (description != null) { - newList.setCommentImpl(description); + newList.setComment(description); } if (id != null) { newList.setId(id); @@ -296,7 +296,7 @@ public class ChangeListWorker implements ChangeListsWriteOperations { final boolean canEdit = list != null && (!list.isReadOnly()); if (canEdit) { final LocalChangeListImpl listImpl = (LocalChangeListImpl) list; - listImpl.setNameImpl(toName); + listImpl.setName(toName); myMap.remove(fromName); myMap.put(toName, list); } @@ -310,7 +310,7 @@ public class ChangeListWorker implements ChangeListsWriteOperations { final String oldComment = list.getComment(); if (! Comparing.equal(oldComment, newComment)) { final LocalChangeListImpl listImpl = (LocalChangeListImpl) list; - listImpl.setCommentImpl(newComment); + listImpl.setComment(newComment); } return oldComment; } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/LocalChangeListImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/LocalChangeListImpl.java index 069af2a49b28..2cc3cd7b3189 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/LocalChangeListImpl.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/LocalChangeListImpl.java @@ -3,7 +3,6 @@ package com.intellij.openapi.vcs.changes; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.Computable; import com.intellij.openapi.util.registry.Registry; import com.intellij.openapi.util.text.StringUtil; @@ -43,13 +42,13 @@ public class LocalChangeListImpl extends LocalChangeList { private LocalChangeListImpl(Project project, final String name) { myProject = project; myId = UUID.randomUUID().toString(); - setNameImpl(name); + setName(name); } private LocalChangeListImpl(LocalChangeListImpl origin) { myId = origin.getId(); myProject = origin.myProject; - setNameImpl(origin.myName); + setName(origin.myName); } @NotNull @@ -76,31 +75,18 @@ public class LocalChangeListImpl extends LocalChangeList { } public void setName(@NotNull final String name) { - if (! myName.equals(name)) { - setNameImpl(name); - } - } - - public String getComment() { - return myComment; - } - - // same as for setName() - public void setComment(final String comment) { - if (! Comparing.equal(comment, myComment)) { - myComment = comment != null ? comment : ""; - } - } - - void setNameImpl(@NotNull final String name) { if (StringUtil.isEmptyOrSpaces(name) && Registry.is("vcs.log.empty.change.list.creation")) { LOG.info("Creating a changelist with empty name"); } myName = name; } - void setCommentImpl(final String comment) { - myComment = comment; + public String getComment() { + return myComment; + } + + public void setComment(final String comment) { + myComment = comment != null ? comment : ""; } public boolean isDefault() {