Revision 46260bb5
Added by Patrick Plitzner over 5 years ago
eu.etaxonomy.taxeditor.store/plugin.xml | ||
---|---|---|
78 | 78 |
name="%wizard.name.17"> |
79 | 79 |
</wizard> |
80 | 80 |
</extension> |
81 |
<extension |
|
82 |
point="org.eclipse.ui.themes"> |
|
83 |
<themeElementCategory |
|
84 |
id="eu.etaxonomy.taxeditor.preferences.themeElementCategory" |
|
85 |
label="%themeElementCategory.label"> |
|
86 |
<description> |
|
87 |
%themeElementCategory.description |
|
88 |
</description> |
|
89 |
</themeElementCategory> |
|
90 |
<themeElementCategory |
|
91 |
id="eu.etaxonomy.taxeditor.preferences.themeElementCategory.detailsView" |
|
92 |
label="%themeElementCategory.label.0" |
|
93 |
parentId="eu.etaxonomy.taxeditor.preferences.themeElementCategory"> |
|
94 |
<description> |
|
95 |
%themeElementCategory.description.0 |
|
96 |
</description> |
|
97 |
</themeElementCategory> |
|
98 |
<themeElementCategory |
|
99 |
id="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor" |
|
100 |
label="%themeElementCategory.label.1" |
|
101 |
parentId="eu.etaxonomy.taxeditor.preferences.themeElementCategory"> |
|
102 |
<description> |
|
103 |
%themeElementCategory.description.1 |
|
104 |
</description> |
|
105 |
</themeElementCategory> |
|
106 |
<fontDefinition |
|
107 |
categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor" |
|
108 |
id="eu.etaxonomy.taxeditor.preferences.fontDefinition.nameEditor.accepted" |
|
109 |
label="%fontDefinition.label" |
|
110 |
value="Georgia-regular-12"> |
|
111 |
</fontDefinition> |
|
112 |
<fontDefinition |
|
113 |
categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor" |
|
114 |
id="eu.etaxonomy.taxeditor.preferences.fontDefinition.nameEditor.synonym" |
|
115 |
label="%fontDefinition.label.0" |
|
116 |
value="Georgia-regular-10"> |
|
117 |
</fontDefinition> |
|
118 |
<fontDefinition |
|
119 |
categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor" |
|
120 |
id="eu.etaxonomy.taxeditor.preferences.fontDefinition.nameEditor.misapplication" |
|
121 |
label="%fontDefinition.label.1" |
|
122 |
value="Georgia-regular-10"> |
|
123 |
</fontDefinition> |
|
124 |
<fontDefinition |
|
125 |
categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor" |
|
126 |
id="eu.etaxonomy.taxeditor.preferences.fontDefinition.nameEditor.concept" |
|
127 |
label="%fontDefinition.label.2" |
|
128 |
value="Georgia-regular-10"> |
|
129 |
</fontDefinition> |
|
130 |
<fontDefinition |
|
131 |
categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor" |
|
132 |
id="eu.etaxonomy.taxeditor.preferences.fontDefinition.nameEditor.default" |
|
133 |
label="%fontDefinition.label.3" |
|
134 |
value="Georgia-regular-10"> |
|
135 |
</fontDefinition> |
|
136 |
<themeElementCategory |
|
137 |
id="eu.etaxonomy.taxeditor.preferences.themeElementCategory.searchView" |
|
138 |
label="%themeElementCategory.label.2" |
|
139 |
parentId="eu.etaxonomy.taxeditor.preferences.themeElementCategory"> |
|
140 |
<description> |
|
141 |
%themeElementCategory.description.2 |
|
142 |
</description> |
|
143 |
</themeElementCategory> |
|
144 |
<fontDefinition |
|
145 |
categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.searchView" |
|
146 |
id="eu.etaxonomy.taxeditor.preferences.fontDefinition.searchView.accepted" |
|
147 |
isEditable="true" |
|
148 |
label="%fontDefinition.label.4" |
|
149 |
value="Arial-regular-10"> |
|
150 |
<description> |
|
151 |
%fontDefinition.description |
|
152 |
</description> |
|
153 |
</fontDefinition> |
|
154 |
<fontDefinition |
|
155 |
categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.searchView" |
|
156 |
id="eu.etaxonomy.taxeditor.preferences.fontDefinition.searchView.synonym" |
|
157 |
isEditable="true" |
|
158 |
label="%fontDefinition.label.5" |
|
159 |
value="Arial-italic-10"> |
|
160 |
<description> |
|
161 |
%fontDefinition.description.0 |
|
162 |
</description> |
|
163 |
</fontDefinition> |
|
164 |
<fontDefinition |
|
165 |
categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.searchView" |
|
166 |
id="eu.etaxonomy.taxeditor.preferences.fontDefinition.searchView.other" |
|
167 |
isEditable="true" |
|
168 |
label="%fontDefinition.label.6" |
|
169 |
value="Lucida Grande-regular-11"> |
|
170 |
<description> |
|
171 |
%fontDefinition.description.1 |
|
172 |
</description> |
|
173 |
</fontDefinition> |
|
174 |
</extension> |
|
175 | 81 |
<extension |
176 | 82 |
point="org.eclipse.core.expressions.propertyTesters"> |
177 | 83 |
<propertyTester |
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.FontRegistry; |
|
52 | 51 |
import org.eclipse.jface.viewers.IStructuredSelection; |
53 | 52 |
import org.eclipse.jface.viewers.SelectionChangedEvent; |
54 | 53 |
import org.eclipse.swt.graphics.Color; |
... | ... | |
128 | 127 |
return themeManager.getCurrentTheme(); |
129 | 128 |
} |
130 | 129 |
|
131 |
/** |
|
132 |
* Fonts registered to the plugin may be obtained with the Eclipse themeing |
|
133 |
* functionality. Thus fonts are chooseable by the user via |
|
134 |
* Preferences->General->Appearance->Colors and Fonts |
|
135 |
* |
|
136 |
* @return the FontRegistry for the current theme |
|
137 |
*/ |
|
138 |
public static FontRegistry getFontRegistry() { |
|
139 |
return getCurrentTheme().getFontRegistry(); |
|
140 |
} |
|
141 |
|
|
142 | 130 |
public static Font getFont(String symbolicName) { |
143 |
return getFontRegistry().get(symbolicName);
|
|
131 |
return FontResources.getFont(symbolicName);
|
|
144 | 132 |
} |
145 | 133 |
|
146 | 134 |
public static Color getColor(String symbolicName) { |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/FontResources.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.FontRegistry; |
|
13 |
import org.eclipse.swt.SWT; |
|
14 |
import org.eclipse.swt.graphics.Font; |
|
15 |
import org.eclipse.swt.graphics.FontData; |
|
16 |
|
|
17 |
import eu.etaxonomy.taxeditor.preference.Resources; |
|
18 |
|
|
19 |
/** |
|
20 |
* |
|
21 |
* @author pplitzner |
|
22 |
* @since Nov 1, 2017 |
|
23 |
* |
|
24 |
*/ |
|
25 |
public class FontResources { |
|
26 |
|
|
27 |
private static FontResources instance; |
|
28 |
|
|
29 |
public static FontResources getInstance(){ |
|
30 |
if(instance == null){ |
|
31 |
instance = new FontResources(); |
|
32 |
} |
|
33 |
return instance; |
|
34 |
} |
|
35 |
|
|
36 |
private static FontRegistry fontRegistry; |
|
37 |
|
|
38 |
public FontRegistry getFontRegistry() { |
|
39 |
if (fontRegistry == null) { |
|
40 |
fontRegistry = new FontRegistry(); |
|
41 |
initializeFontRegistry(fontRegistry); |
|
42 |
} |
|
43 |
return fontRegistry; |
|
44 |
} |
|
45 |
|
|
46 |
public static Font getFont(String key){ |
|
47 |
return getInstance().getFontRegistry().get(key); |
|
48 |
} |
|
49 |
|
|
50 |
protected void initializeFontRegistry(FontRegistry registry) { |
|
51 |
registerFont(registry, Resources.ACCEPTED_TAXON_FONT, "Georgia", 12, SWT.NORMAL); |
|
52 |
registerFont(registry, Resources.SYNONYM_FONT, "Georgia", 10, SWT.NORMAL); |
|
53 |
registerFont(registry, Resources.MISAPPLIEDNAME_FONT, "Georgia", 10, SWT.NORMAL); |
|
54 |
registerFont(registry, Resources.CONCEPT_FONT, "Georgia", 10, SWT.NORMAL); |
|
55 |
registerFont(registry, Resources.FONT_DEFAULT_PROMPT, "Georgia", 10, SWT.NORMAL); |
|
56 |
registerFont(registry, Resources.FONT_SEARCH_VIEW_ACCEPTED, "Arial", 10, SWT.NORMAL); |
|
57 |
registerFont(registry, Resources.FONT_SEARCH_VIEW_SYNONYM, "Arial", 10, SWT.ITALIC); |
|
58 |
registerFont(registry, Resources.FONT_SEARCH_VIEW_OTHER, "Lucida Grande", 11, SWT.NORMAL); |
|
59 |
} |
|
60 |
|
|
61 |
private void registerFont(FontRegistry registry, String key, String name, int height, int style) { |
|
62 |
registry.put(key, new FontData[]{new FontData(name, height, style)}); |
|
63 |
} |
|
64 |
} |
Also available in: Unified diff
ref #7044 Migrate font theme