package jetbrains.mps.vcs.diff.ui.common; /*Generated by MPS */ import java.util.Map; import jetbrains.mps.vcs.diff.changes.ChangeType; import java.awt.Color; import java.util.EnumMap; import jetbrains.mps.openapi.editor.style.StyleRegistry; import jetbrains.mps.editor.runtime.style.StyleAttributes; import org.jetbrains.annotations.NotNull; import jetbrains.mps.internal.collections.runtime.MapSequence; import com.intellij.openapi.vcs.FileStatus; public class ChangeColors { private static final Map<ChangeType, Color> ourColors = new EnumMap<ChangeType, Color>(ChangeType.class); private static final Map<ChangeType, Color> ourTreeColors = new EnumMap<ChangeType, Color>(ChangeType.class); public static final Color ADD = StyleRegistry.getInstance().getStyle("DIFF_INSERTED").get(StyleAttributes.TEXT_BACKGROUND_COLOR); public static final Color DELETE = StyleRegistry.getInstance().getStyle("DIFF_DELETED").get(StyleAttributes.TEXT_BACKGROUND_COLOR); public static final Color CHANGE = StyleRegistry.getInstance().getStyle("DIFF_MODIFIED").get(StyleAttributes.TEXT_BACKGROUND_COLOR); private static final Color CONFLICTED = StyleRegistry.getInstance().getStyle("DIFF_CONFLICT").get(StyleAttributes.TEXT_BACKGROUND_COLOR); private ChangeColors() { } @NotNull public static Color get(@NotNull ChangeType changeType) { return MapSequence.fromMap(ourColors).get(changeType); } @NotNull public static Color getForTree(@NotNull ChangeType changeType) { return MapSequence.fromMap(ourTreeColors).get(changeType); } static { MapSequence.fromMap(ourColors).put(ChangeType.ADD, ADD); MapSequence.fromMap(ourTreeColors).put(ChangeType.ADD, FileStatus.ADDED.getColor()); MapSequence.fromMap(ourColors).put(ChangeType.DELETE, DELETE); MapSequence.fromMap(ourTreeColors).put(ChangeType.DELETE, FileStatus.DELETED.getColor()); MapSequence.fromMap(ourColors).put(ChangeType.CHANGE, CHANGE); MapSequence.fromMap(ourTreeColors).put(ChangeType.CHANGE, FileStatus.MODIFIED.getColor()); MapSequence.fromMap(ourColors).put(ChangeType.CONFLICTED, CONFLICTED); MapSequence.fromMap(ourTreeColors).put(ChangeType.CONFLICTED, FileStatus.MERGED_WITH_CONFLICTS.getColor()); } }