name="%wizard.name.17">
</wizard>
</extension>
-<extension
- point="org.eclipse.ui.themes">
- <themeElementCategory
- id="eu.etaxonomy.taxeditor.preferences.themeElementCategory"
- label="%themeElementCategory.label">
- <description>
- %themeElementCategory.description
- </description>
- </themeElementCategory>
- <themeElementCategory
- id="eu.etaxonomy.taxeditor.preferences.themeElementCategory.detailsView"
- label="%themeElementCategory.label.0"
- parentId="eu.etaxonomy.taxeditor.preferences.themeElementCategory">
- <description>
- %themeElementCategory.description.0
- </description>
- </themeElementCategory>
- <themeElementCategory
- id="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor"
- label="%themeElementCategory.label.1"
- parentId="eu.etaxonomy.taxeditor.preferences.themeElementCategory">
- <description>
- %themeElementCategory.description.1
- </description>
- </themeElementCategory>
- <fontDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor"
- id="eu.etaxonomy.taxeditor.preferences.fontDefinition.nameEditor.accepted"
- label="%fontDefinition.label"
- value="Georgia-regular-12">
- </fontDefinition>
- <fontDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor"
- id="eu.etaxonomy.taxeditor.preferences.fontDefinition.nameEditor.synonym"
- label="%fontDefinition.label.0"
- value="Georgia-regular-10">
- </fontDefinition>
- <fontDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor"
- id="eu.etaxonomy.taxeditor.preferences.fontDefinition.nameEditor.misapplication"
- label="%fontDefinition.label.1"
- value="Georgia-regular-10">
- </fontDefinition>
- <fontDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor"
- id="eu.etaxonomy.taxeditor.preferences.fontDefinition.nameEditor.concept"
- label="%fontDefinition.label.2"
- value="Georgia-regular-10">
- </fontDefinition>
- <fontDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor"
- id="eu.etaxonomy.taxeditor.preferences.fontDefinition.nameEditor.default"
- label="%fontDefinition.label.3"
- value="Georgia-regular-10">
- </fontDefinition>
- <themeElementCategory
- id="eu.etaxonomy.taxeditor.preferences.themeElementCategory.searchView"
- label="%themeElementCategory.label.2"
- parentId="eu.etaxonomy.taxeditor.preferences.themeElementCategory">
- <description>
- %themeElementCategory.description.2
- </description>
- </themeElementCategory>
- <fontDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.searchView"
- id="eu.etaxonomy.taxeditor.preferences.fontDefinition.searchView.accepted"
- isEditable="true"
- label="%fontDefinition.label.4"
- value="Arial-regular-10">
- <description>
- %fontDefinition.description
- </description>
- </fontDefinition>
- <fontDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.searchView"
- id="eu.etaxonomy.taxeditor.preferences.fontDefinition.searchView.synonym"
- isEditable="true"
- label="%fontDefinition.label.5"
- value="Arial-italic-10">
- <description>
- %fontDefinition.description.0
- </description>
- </fontDefinition>
- <fontDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.searchView"
- id="eu.etaxonomy.taxeditor.preferences.fontDefinition.searchView.other"
- isEditable="true"
- label="%fontDefinition.label.6"
- value="Lucida Grande-regular-11">
- <description>
- %fontDefinition.description.1
- </description>
- </fontDefinition>
- </extension>
<extension
point="org.eclipse.core.expressions.propertyTesters">
<propertyTester
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.resource.FontRegistry;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.graphics.Color;
return themeManager.getCurrentTheme();
}
- /**
- * Fonts registered to the plugin may be obtained with the Eclipse themeing
- * functionality. Thus fonts are chooseable by the user via
- * Preferences->General->Appearance->Colors and Fonts
- *
- * @return the FontRegistry for the current theme
- */
- public static FontRegistry getFontRegistry() {
- return getCurrentTheme().getFontRegistry();
- }
-
public static Font getFont(String symbolicName) {
- return getFontRegistry().get(symbolicName);
+ return FontResources.getFont(symbolicName);
}
public static Color getColor(String symbolicName) {
--- /dev/null
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.model;
+
+import org.eclipse.jface.resource.FontRegistry;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+
+import eu.etaxonomy.taxeditor.preference.Resources;
+
+/**
+ *
+ * @author pplitzner
+ * @since Nov 1, 2017
+ *
+ */
+public class FontResources {
+
+ private static FontResources instance;
+
+ public static FontResources getInstance(){
+ if(instance == null){
+ instance = new FontResources();
+ }
+ return instance;
+ }
+
+ private static FontRegistry fontRegistry;
+
+ public FontRegistry getFontRegistry() {
+ if (fontRegistry == null) {
+ fontRegistry = new FontRegistry();
+ initializeFontRegistry(fontRegistry);
+ }
+ return fontRegistry;
+ }
+
+ public static Font getFont(String key){
+ return getInstance().getFontRegistry().get(key);
+ }
+
+ protected void initializeFontRegistry(FontRegistry registry) {
+ registerFont(registry, Resources.ACCEPTED_TAXON_FONT, "Georgia", 12, SWT.NORMAL);
+ registerFont(registry, Resources.SYNONYM_FONT, "Georgia", 10, SWT.NORMAL);
+ registerFont(registry, Resources.MISAPPLIEDNAME_FONT, "Georgia", 10, SWT.NORMAL);
+ registerFont(registry, Resources.CONCEPT_FONT, "Georgia", 10, SWT.NORMAL);
+ registerFont(registry, Resources.FONT_DEFAULT_PROMPT, "Georgia", 10, SWT.NORMAL);
+ registerFont(registry, Resources.FONT_SEARCH_VIEW_ACCEPTED, "Arial", 10, SWT.NORMAL);
+ registerFont(registry, Resources.FONT_SEARCH_VIEW_SYNONYM, "Arial", 10, SWT.ITALIC);
+ registerFont(registry, Resources.FONT_SEARCH_VIEW_OTHER, "Lucida Grande", 11, SWT.NORMAL);
+ }
+
+ private void registerFont(FontRegistry registry, String key, String name, int height, int style) {
+ registry.put(key, new FontData[]{new FontData(name, height, style)});
+ }
+}