Revision 398bb6b8
Added by Patrick Plitzner over 6 years ago
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchResultLabelProvider.java | ||
---|---|---|
1 | 1 |
// $$Id$$ |
2 | 2 |
/** |
3 | 3 |
* Copyright (C) 2007 EDIT |
4 |
* European Distributed Institute of Taxonomy
|
|
4 |
* European Distributed Institute of Taxonomy |
|
5 | 5 |
* http://www.e-taxonomy.eu |
6 |
*
|
|
6 |
* |
|
7 | 7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
8 | 8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
9 | 9 |
*/ |
... | ... | |
33 | 33 |
* @version 1.0 |
34 | 34 |
*/ |
35 | 35 |
public class SearchResultLabelProvider extends ColumnLabelProvider implements ILabelProvider { |
36 |
|
|
36 |
|
|
37 | 37 |
/** {@inheritDoc} */ |
38 |
public String getText(Object element) { |
|
38 |
@Override |
|
39 |
public String getText(Object element) { |
|
39 | 40 |
if(element instanceof UuidAndTitleCache){ |
40 | 41 |
return ((UuidAndTitleCache) element).getTitleCache(); |
41 | 42 |
} |
... | ... | |
66 | 67 |
} |
67 | 68 |
} |
68 | 69 |
|
69 |
/* (non-Javadoc) |
|
70 |
* @see org.eclipse.jface.viewers.ColumnLabelProvider#getForeground(java.lang.Object) |
|
71 |
*/ |
|
72 |
/** {@inheritDoc} */ |
|
73 |
@Override |
|
74 |
public Color getForeground(Object element) { |
|
75 |
if(element instanceof UuidAndTitleCache){ |
|
76 |
Class type = ((UuidAndTitleCache) element).getType(); |
|
77 |
if(type == Taxon.class){ |
|
78 |
return NavigationUtil.getColorRegistry().get("eu.etaxonomy.taxeditor.preferences.searchResult.fontColorAccepted"); //$NON-NLS-1$ |
|
79 |
}else if(type == Synonym.class){ |
|
80 |
return NavigationUtil.getColorRegistry().get("eu.etaxonomy.taxeditor.preferences.searchResult.fontColorSynonym"); //$NON-NLS-1$ |
|
81 |
} |
|
82 |
} |
|
83 |
return NavigationUtil.getColorRegistry().get("eu.etaxonomy.taxeditor.preferences.searchResult.fontColorDefault"); //$NON-NLS-1$ |
|
84 |
} |
|
85 |
|
|
86 | 70 |
/* (non-Javadoc) |
87 | 71 |
* @see org.eclipse.jface.viewers.ColumnLabelProvider#getImage(java.lang.Object) |
88 | 72 |
*/ |
... | ... | |
109 | 93 |
|
110 | 94 |
/* (non-Javadoc) |
111 | 95 |
* @see org.eclipse.jface.viewers.CellLabelProvider#getToolTipText(java.lang.Object) |
112 |
*
|
|
96 |
* |
|
113 | 97 |
* does not seem t work right now |
114 | 98 |
*/ |
115 | 99 |
/** {@inheritDoc} */ |
... | ... | |
124 | 108 |
} |
125 | 109 |
return Messages.SearchResultLabelProvider_NAME + element.toString(); |
126 | 110 |
} |
127 |
|
|
128 |
|
|
129 |
|
|
111 |
|
|
112 |
|
|
113 |
|
|
130 | 114 |
} |
eu.etaxonomy.taxeditor.store/plugin.xml | ||
---|---|---|
87 | 87 |
%themeElementCategory.description |
88 | 88 |
</description> |
89 | 89 |
</themeElementCategory> |
90 |
<colorDefinition |
|
91 |
categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory" |
|
92 |
id="eu.etaxonomy.taxeditor.preferences.colorDefinition.listBackground" |
|
93 |
label="%colorDefinition.label" |
|
94 |
value="150,150,150"> |
|
95 |
</colorDefinition> |
|
96 |
<colorDefinition |
|
97 |
categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory" |
|
98 |
id="eu.etaxonomy.taxeditor.preferences.colorDefinition.textDefault" |
|
99 |
label="%colorDefinition.label.0" |
|
100 |
value="0,0,0"> |
|
101 |
</colorDefinition> |
|
102 |
<colorDefinition |
|
103 |
categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory" |
|
104 |
id="eu.etaxonomy.taxeditor.preferences.colorDefinition.colorCompositeBackground" |
|
105 |
label="%colorDefinition.label.1" |
|
106 |
value="255,255,255"> |
|
107 |
</colorDefinition> |
|
108 |
<colorDefinition |
|
109 |
categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory" |
|
110 |
id="eu.etaxonomy.taxeditor.preferences.colorDefinition.colorCompositeIrrelevant" |
|
111 |
label="%colorDefinition.label.2" |
|
112 |
value="241,139,18"> |
|
113 |
</colorDefinition> |
|
114 |
<colorDefinition |
|
115 |
categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory" |
|
116 |
id="eu.etaxonomy.taxeditor.preferences.colorDefinition.textDisabled" |
|
117 |
label="%colorDefinition.label.3" |
|
118 |
value="150,150,150"> |
|
119 |
</colorDefinition> |
|
120 |
<colorDefinition |
|
121 |
categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory" |
|
122 |
id="eu.etaxonomy.taxeditor.preferences.colorDefinition.textBackgroundDisabled" |
|
123 |
label="%colorDefinition.label.4" |
|
124 |
value="230,230,230"> |
|
125 |
</colorDefinition> |
|
126 | 90 |
<themeElementCategory |
127 | 91 |
id="eu.etaxonomy.taxeditor.preferences.themeElementCategory.detailsView" |
128 | 92 |
label="%themeElementCategory.label.0" |
... | ... | |
131 | 95 |
%themeElementCategory.description.0 |
132 | 96 |
</description> |
133 | 97 |
</themeElementCategory> |
134 |
<colorDefinition |
|
135 |
categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.detailsView" |
|
136 |
id="eu.etaxonomy.taxeditor.preferences.colorDefinition.listBackgroundOdd" |
|
137 |
label="%colorDefinition.label.5" |
|
138 |
value="230,230,230"> |
|
139 |
</colorDefinition> |
|
140 |
<colorDefinition |
|
141 |
categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.detailsView" |
|
142 |
id="eu.etaxonomy.taxeditor.preferences.colorDefinition.listBackgroundEven" |
|
143 |
label="%colorDefinition.label.6" |
|
144 |
value="255,255,255"> |
|
145 |
</colorDefinition> |
|
146 | 98 |
<themeElementCategory |
147 | 99 |
id="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor" |
148 | 100 |
label="%themeElementCategory.label.1" |
... | ... | |
151 | 103 |
%themeElementCategory.description.1 |
152 | 104 |
</description> |
153 | 105 |
</themeElementCategory> |
154 |
<colorDefinition |
|
155 |
categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor" |
|
156 |
id="eu.etaxonomy.taxeditor.preferences.colorDefinition.nameEditor.colorContainerBackground" |
|
157 |
label="%colorDefinition.label.7" |
|
158 |
value="220, 220, 220"> |
|
159 |
</colorDefinition> |
|
160 |
<colorDefinition |
|
161 |
categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor" |
|
162 |
id="eu.etaxonomy.taxeditor.preferences.colorDefinition.nameEditor.colorContainerSelectedFocus" |
|
163 |
label="%colorDefinition.label.8" |
|
164 |
value="232,242,254"> |
|
165 |
</colorDefinition> |
|
166 |
<colorDefinition |
|
167 |
categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor" |
|
168 |
id="eu.etaxonomy.taxeditor.preferences.colorDefinition.nameEditor.colorContainerSelected" |
|
169 |
label="%colorDefinition.label.9" |
|
170 |
value="210, 210, 210"> |
|
171 |
</colorDefinition> |
|
172 |
<colorDefinition |
|
173 |
categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor" |
|
174 |
id="eu.etaxonomy.taxeditor.preferences.colorDefinition.nameEditor.colorContainerDragEnter" |
|
175 |
label="%colorDefinition.label.10" |
|
176 |
value="185,255,133"> |
|
177 |
</colorDefinition> |
|
178 | 106 |
<fontDefinition |
179 | 107 |
categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor" |
180 | 108 |
id="eu.etaxonomy.taxeditor.preferences.fontDefinition.nameEditor.accepted" |
... | ... | |
213 | 141 |
%themeElementCategory.description.2 |
214 | 142 |
</description> |
215 | 143 |
</themeElementCategory> |
216 |
<colorDefinition |
|
217 |
categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.searchView" |
|
218 |
id="eu.etaxonomy.taxeditor.preferences.colorDefinition.searchView.foreground" |
|
219 |
label="%colorDefinition.label.11" |
|
220 |
value="192, 192, 192"> |
|
221 |
</colorDefinition> |
|
222 |
<colorDefinition |
|
223 |
categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.searchView" |
|
224 |
id="eu.etaxonomy.taxeditor.preferences.colorDefinition.searchView.focus" |
|
225 |
label="%colorDefinition.label.12" |
|
226 |
value="0, 0, 0"> |
|
227 |
</colorDefinition> |
|
228 | 144 |
<fontDefinition |
229 | 145 |
categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.searchView" |
230 | 146 |
id="eu.etaxonomy.taxeditor.preferences.fontDefinition.searchView.accepted" |
... | ... | |
255 | 171 |
%fontDefinition.description.1 |
256 | 172 |
</description> |
257 | 173 |
</fontDefinition> |
258 |
<colorDefinition |
|
259 |
categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.detailsView" |
|
260 |
id="eu.etaxonomy.taxeditor.preferences.colorDefinition.parseError" |
|
261 |
label="%colorDefinition.label.13" |
|
262 |
value="255,0,0"> |
|
263 |
</colorDefinition> |
|
264 |
<colorDefinition |
|
265 |
categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor" |
|
266 |
id="eu.etaxonomy.taxeditor.preferences.colorDefinition.disabledEditor" |
|
267 |
label="%colorDefinition.label.14" |
|
268 |
value="105,114,124"> |
|
269 |
</colorDefinition> |
|
270 |
<colorDefinition |
|
271 |
categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory" |
|
272 |
id="eu.etaxonomy.taxeditor.preferences.colorDefinition.editorError" |
|
273 |
label="%colorDefinition.label.15" |
|
274 |
value="255,0,0"> |
|
275 |
</colorDefinition> |
|
276 | 174 |
</extension> |
277 | 175 |
<extension |
278 | 176 |
point="org.eclipse.core.expressions.propertyTesters"> |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/AbstractUtility.java | ||
---|---|---|
48 | 48 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
49 | 49 |
import org.eclipse.e4.ui.workbench.modeling.EPartService; |
50 | 50 |
import org.eclipse.jface.action.IStatusLineManager; |
51 |
import org.eclipse.jface.resource.ColorRegistry; |
|
52 | 51 |
import org.eclipse.jface.resource.FontRegistry; |
53 | 52 |
import org.eclipse.jface.viewers.IStructuredSelection; |
54 | 53 |
import org.eclipse.jface.viewers.SelectionChangedEvent; |
... | ... | |
144 | 143 |
return getFontRegistry().get(symbolicName); |
145 | 144 |
} |
146 | 145 |
|
147 |
/** |
|
148 |
* Color registered to the plugin may be obtained with the Eclipse themeing |
|
149 |
* functionality. Thus colors are editable by the user via |
|
150 |
* Preferences->General->Appearance->Colors and Fonts |
|
151 |
* |
|
152 |
* @return the ColorRegistry for the current theme |
|
153 |
*/ |
|
154 |
public static ColorRegistry getColorRegistry() { |
|
155 |
return getCurrentTheme().getColorRegistry(); |
|
156 |
} |
|
157 |
|
|
158 | 146 |
public static Color getColor(String symbolicName) { |
159 |
return getColorRegistry().get(symbolicName);
|
|
147 |
return ColorResources.getColor(symbolicName);
|
|
160 | 148 |
} |
161 | 149 |
|
162 | 150 |
public static IStatus executeOperation(final AbstractPostOperation operation, UISynchronize sync) { |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/ColorResources.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2007 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
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. |
|
8 |
*/ |
|
9 |
|
|
10 |
package eu.etaxonomy.taxeditor.model; |
|
11 |
|
|
12 |
import org.eclipse.jface.resource.ColorRegistry; |
|
13 |
import org.eclipse.swt.graphics.Color; |
|
14 |
import org.eclipse.swt.graphics.RGB; |
|
15 |
|
|
16 |
import eu.etaxonomy.taxeditor.preference.Resources; |
|
17 |
|
|
18 |
/** |
|
19 |
* |
|
20 |
* @author pplitzner |
|
21 |
* @since Nov 1, 2017 |
|
22 |
* |
|
23 |
*/ |
|
24 |
public class ColorResources { |
|
25 |
|
|
26 |
private static ColorResources instance; |
|
27 |
|
|
28 |
public static ColorResources getInstance(){ |
|
29 |
if(instance == null){ |
|
30 |
instance = new ColorResources(); |
|
31 |
} |
|
32 |
return instance; |
|
33 |
} |
|
34 |
|
|
35 |
private static ColorRegistry colorRegistry; |
|
36 |
|
|
37 |
public ColorRegistry getColorRegistry() { |
|
38 |
if (colorRegistry == null) { |
|
39 |
colorRegistry = new ColorRegistry(); |
|
40 |
initializeColorRegistry(colorRegistry); |
|
41 |
} |
|
42 |
return colorRegistry; |
|
43 |
} |
|
44 |
|
|
45 |
public static Color getColor(String key){ |
|
46 |
return getInstance().getColorRegistry().get(key); |
|
47 |
} |
|
48 |
|
|
49 |
protected void initializeColorRegistry(ColorRegistry registry) { |
|
50 |
registerColor(registry, Resources.COLOR_COMPOSITE_BACKGROUND, 255,255,255); |
|
51 |
registerColor(registry, Resources.COLOR_CONTROL_BACKGROUND, 220, 220, 220); |
|
52 |
registerColor(registry, Resources.COLOR_CONTROL_SELECTED, 210, 210, 210); |
|
53 |
registerColor(registry, Resources.COLOR_CONTROL_SELECTED_FOCUS, 232,242,254); |
|
54 |
registerColor(registry, Resources.COLOR_COMPOSITE_IRRELEVANT, 241,139,18); |
|
55 |
registerColor(registry, Resources.SEARCH_VIEW_FOREGROUND, 192, 192, 192); |
|
56 |
registerColor(registry, Resources.SEARCH_VIEW_FOCUS, 0, 0, 0); |
|
57 |
registerColor(registry, Resources.COLOR_LIST_BACKGROUND, 150,150,150); |
|
58 |
registerColor(registry, Resources.COLOR_FONT_DEFAULT, 0,0,0); |
|
59 |
registerColor(registry, Resources.COLOR_TEXT_DISABLED, 150,150,150); |
|
60 |
registerColor(registry, Resources.COLOR_TEXT_DISABLED_BACKGROUND, 230,230,230); |
|
61 |
registerColor(registry, Resources.COLOR_DRAG_ENTER, 185,255,133); |
|
62 |
registerColor(registry, Resources.COLOR_LIST_EVEN, 255,255,255); |
|
63 |
registerColor(registry, Resources.COLOR_LIST_ODD, 230,230,230); |
|
64 |
registerColor(registry, Resources.COLOR_PARSE_ERROR, 255,0,0); |
|
65 |
registerColor(registry, Resources.COLOR_DISABLED_EDITOR, 105,114,124); |
|
66 |
registerColor(registry, Resources.COLOR_EDITOR_ERROR, 255,0,0); |
|
67 |
} |
|
68 |
|
|
69 |
private void registerColor(ColorRegistry registry, String key, |
|
70 |
int red, int green, int blue) { |
|
71 |
registry.put(key, new RGB(red, green, blue)); |
|
72 |
} |
|
73 |
} |
Also available in: Unified diff
ref #7044 Migrate color theme