2 * Copyright (C) 2021 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
9 package eu
.etaxonomy
.taxeditor
.ui
.element
;
11 import org
.eclipse
.swt
.graphics
.Color
;
13 import eu
.etaxonomy
.taxeditor
.model
.AbstractUtility
;
14 import eu
.etaxonomy
.taxeditor
.preference
.Resources
;
20 public enum CacheRelevance
{
21 CACHE1(Resources
.COLOR_COMPOSITE_IRRELEVANT1
, null),
22 CACHE2(Resources
.COLOR_COMPOSITE_IRRELEVANT2
, null),
24 CACHE1_2(Resources
.COLOR_COMPOSITE_IRRELEVANT1_2
, null),
25 CACHE1_LIGHT(Resources
.COLOR_COMPOSITE_IRRELEVANT1_LIGHT
, CACHE1
),
26 CACHE2_LIGHT(Resources
.COLOR_COMPOSITE_IRRELEVANT2_LIGHT
, CACHE2
),
27 CACHE1_2_LIGHT(Resources
.COLOR_COMPOSITE_IRRELEVANT1_2_LIGHT
, CACHE1_2
),
28 NONE(Resources
.COLOR_COMPOSITE_BACKGROUND
, null),
31 private final Color color
;
32 private CacheRelevance light
;
35 private CacheRelevance(String colorStr
, CacheRelevance main
){
36 this.color
= AbstractUtility
.getColor(colorStr
);
43 public Color
getColor() {
46 public Color
getColorLight() {
50 public Color
getColor(String alternativeColorForNone
) {
52 return AbstractUtility
.getColor(alternativeColorForNone
);
58 public CacheRelevance
addCacheRelevance(CacheRelevance that
){
59 if (this == CACHE1
&& that
== CACHE2
|| this == CACHE2
&& that
== CACHE1
){
61 } else if (this == CACHE1_LIGHT
&& that
== CACHE2_LIGHT
|| this == CACHE2_LIGHT
&& that
== CACHE1_LIGHT
){
62 return CACHE1_2_LIGHT
;
64 return CacheRelevance
.values()[Math
.min(this.ordinal(), that
.ordinal())];
68 public CacheRelevance
getLight(){