package zielu.gittoolbox.config;

import com.intellij.openapi.vcs.actions.ShortNameType;
import com.intellij.util.xmlb.annotations.Transient;
import org.jetbrains.annotations.Nullable;

public enum AuthorNameType {
  INITIALS(ShortNameType.INITIALS),
  LASTNAME(ShortNameType.LASTNAME),
  FIRSTNAME(ShortNameType.FIRSTNAME),
  NONE(ShortNameType.NONE);

  private final ShortNameType type;

  AuthorNameType(ShortNameType type) {
    this.type = type;
  }

  @Transient
  public String getDescription() {
    return type.getDescription();
  }

  @Nullable
  public String shorten(@Nullable String author) {
    if (author != null) {
      if (type == ShortNameType.LASTNAME) {
        author = author.replaceAll("\\(.*\\)", "");
      }
    }
    return ShortNameType.shorten(author, type);
  }
}

@@ -274,24 +274,241 @@
 pe.LASTNAME)
+ %7B%0A    @Nullable%0A    @Override%0A    public String shorten(@Nullable String author) %7B%0A      if (author != null) %7B%0A        author = author.replaceAll(%22%5C%5C(.*%5C%5C)%22, %22%22);%0A      %7D%0A      return super.shorten(author);%0A    %7D%0A  %7D
 ,%0A  FIRSTNAM
@@ -821,144 +821,8 @@
 ) %7B%0A
-    if (author != null) %7B%0A      if (type == ShortNameType.LASTNAME) %7B%0A        author = author.replaceAll(%22%5C%5C(.*%5C%5C)%22, %22%22);%0A      %7D%0A    %7D%0A
     

Move last name handling to exact type (#126)