// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.editor.colors;

import com.intellij.openapi.editor.Editor;
import com.intellij.util.ObjectUtils;
import org.jetbrains.annotations.NotNull;

import java.awt.Font;
import java.util.HashMap;
import java.util.Map;

public enum EditorFontType {
  PLAIN,
  BOLD,
  ITALIC,
  BOLD_ITALIC,
  CONSOLE_PLAIN,
  CONSOLE_BOLD,
  CONSOLE_ITALIC,
  CONSOLE_BOLD_ITALIC;

  private static final Map<EditorFontType, EditorFontType> ourConsoleTypes = new HashMap<>();
  static {
    ourConsoleTypes.put(PLAIN, CONSOLE_PLAIN);
    ourConsoleTypes.put(ITALIC, CONSOLE_ITALIC);
    ourConsoleTypes.put(BOLD_ITALIC, CONSOLE_BOLD_ITALIC);
    ourConsoleTypes.put(BOLD, CONSOLE_BOLD);
  }

  public static EditorFontType getConsoleType(EditorFontType fontType) {
    return ObjectUtils.chooseNotNull(ourConsoleTypes.get(fontType), fontType);
  }

  /**
   * @return a font of this type according to the global colors scheme
   */
  public @NotNull Font getGlobalFont() {
    return EditorColorsManager.getInstance().getGlobalScheme().getFont(this);
  }
}

@@ -190,80 +190,41 @@
 ort 
-com.intellij.openapi.editor.Editor;%0Aimport com.intellij.util.ObjectUtils
+org.jetbrains.annotations.NotNull
 ;%0Aim
@@ -255,22 +255,23 @@
 ations.N
-otN
 ull
+able
 ;%0A%0Aimpor
@@ -290,56 +290,8 @@
 ont;
-%0Aimport java.util.HashMap;%0Aimport java.util.Map;
 %0A%0Apu
@@ -440,48 +440,141 @@
 %0A%0A  
-private static final Map%3CEditorFontType,
+/**%0A   * @param type a font type to convert%0A   * @return a console variant of the specified font type%0A   */%0A  public static @Nullable
  Edi
@@ -588,13 +588,12 @@
 Type
-%3E our
+ get
 Cons
@@ -603,70 +603,68 @@
 Type
-s = new HashMap%3C%3E();%0A  static %7B%0A    ourConsoleTypes.put(
+(@Nullable EditorFontType type) %7B%0A    return type == 
 PLAIN
-,
+ ?
  CON
@@ -677,42 +677,38 @@
 LAIN
-);
+ :
 %0A    
-ourConsoleTypes.put(
+       type == 
 ITALIC
-,
+ ?
  CON
@@ -722,270 +722,111 @@
 ALIC
-);
+ :
 %0A    
-ourConsoleTypes.put(BOLD_ITALIC, CONSOLE_BOLD_ITALIC);%0A    ourConsoleTypes.put(BOLD, CONSOLE_BOLD);%0A  %7D%0A%0A  public static EditorFontType getConsoleType(EditorFontType fontType) %7B%0A    return ObjectUtils.chooseNotNull(ourConsoleTypes.get(fontType), fontType)
+       type == BOLD ? CONSOLE_BOLD :%0A           type == BOLD_ITALIC ? CONSOLE_BOLD_ITALIC : type
 ;%0A  

Simplify EditorFontType.getConsoleType