// $$Id$$
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* 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.
*/
* @version 1.0
*/
public class SearchResultLabelProvider extends ColumnLabelProvider implements ILabelProvider {
-
+
/** {@inheritDoc} */
- public String getText(Object element) {
+ @Override
+ public String getText(Object element) {
if(element instanceof UuidAndTitleCache){
return ((UuidAndTitleCache) element).getTitleCache();
}
}
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ColumnLabelProvider#getForeground(java.lang.Object)
- */
- /** {@inheritDoc} */
- @Override
- public Color getForeground(Object element) {
- if(element instanceof UuidAndTitleCache){
- Class type = ((UuidAndTitleCache) element).getType();
- if(type == Taxon.class){
- return NavigationUtil.getColorRegistry().get("eu.etaxonomy.taxeditor.preferences.searchResult.fontColorAccepted"); //$NON-NLS-1$
- }else if(type == Synonym.class){
- return NavigationUtil.getColorRegistry().get("eu.etaxonomy.taxeditor.preferences.searchResult.fontColorSynonym"); //$NON-NLS-1$
- }
- }
- return NavigationUtil.getColorRegistry().get("eu.etaxonomy.taxeditor.preferences.searchResult.fontColorDefault"); //$NON-NLS-1$
- }
-
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ColumnLabelProvider#getImage(java.lang.Object)
*/
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.CellLabelProvider#getToolTipText(java.lang.Object)
- *
+ *
* does not seem t work right now
*/
/** {@inheritDoc} */
}
return Messages.SearchResultLabelProvider_NAME + element.toString();
}
-
-
-
+
+
+
}
%themeElementCategory.description
</description>
</themeElementCategory>
- <colorDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory"
- id="eu.etaxonomy.taxeditor.preferences.colorDefinition.listBackground"
- label="%colorDefinition.label"
- value="150,150,150">
- </colorDefinition>
- <colorDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory"
- id="eu.etaxonomy.taxeditor.preferences.colorDefinition.textDefault"
- label="%colorDefinition.label.0"
- value="0,0,0">
- </colorDefinition>
- <colorDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory"
- id="eu.etaxonomy.taxeditor.preferences.colorDefinition.colorCompositeBackground"
- label="%colorDefinition.label.1"
- value="255,255,255">
- </colorDefinition>
- <colorDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory"
- id="eu.etaxonomy.taxeditor.preferences.colorDefinition.colorCompositeIrrelevant"
- label="%colorDefinition.label.2"
- value="241,139,18">
- </colorDefinition>
- <colorDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory"
- id="eu.etaxonomy.taxeditor.preferences.colorDefinition.textDisabled"
- label="%colorDefinition.label.3"
- value="150,150,150">
- </colorDefinition>
- <colorDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory"
- id="eu.etaxonomy.taxeditor.preferences.colorDefinition.textBackgroundDisabled"
- label="%colorDefinition.label.4"
- value="230,230,230">
- </colorDefinition>
<themeElementCategory
id="eu.etaxonomy.taxeditor.preferences.themeElementCategory.detailsView"
label="%themeElementCategory.label.0"
%themeElementCategory.description.0
</description>
</themeElementCategory>
- <colorDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.detailsView"
- id="eu.etaxonomy.taxeditor.preferences.colorDefinition.listBackgroundOdd"
- label="%colorDefinition.label.5"
- value="230,230,230">
- </colorDefinition>
- <colorDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.detailsView"
- id="eu.etaxonomy.taxeditor.preferences.colorDefinition.listBackgroundEven"
- label="%colorDefinition.label.6"
- value="255,255,255">
- </colorDefinition>
<themeElementCategory
id="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor"
label="%themeElementCategory.label.1"
%themeElementCategory.description.1
</description>
</themeElementCategory>
- <colorDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor"
- id="eu.etaxonomy.taxeditor.preferences.colorDefinition.nameEditor.colorContainerBackground"
- label="%colorDefinition.label.7"
- value="220, 220, 220">
- </colorDefinition>
- <colorDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor"
- id="eu.etaxonomy.taxeditor.preferences.colorDefinition.nameEditor.colorContainerSelectedFocus"
- label="%colorDefinition.label.8"
- value="232,242,254">
- </colorDefinition>
- <colorDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor"
- id="eu.etaxonomy.taxeditor.preferences.colorDefinition.nameEditor.colorContainerSelected"
- label="%colorDefinition.label.9"
- value="210, 210, 210">
- </colorDefinition>
- <colorDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor"
- id="eu.etaxonomy.taxeditor.preferences.colorDefinition.nameEditor.colorContainerDragEnter"
- label="%colorDefinition.label.10"
- value="185,255,133">
- </colorDefinition>
<fontDefinition
categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor"
id="eu.etaxonomy.taxeditor.preferences.fontDefinition.nameEditor.accepted"
%themeElementCategory.description.2
</description>
</themeElementCategory>
- <colorDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.searchView"
- id="eu.etaxonomy.taxeditor.preferences.colorDefinition.searchView.foreground"
- label="%colorDefinition.label.11"
- value="192, 192, 192">
- </colorDefinition>
- <colorDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.searchView"
- id="eu.etaxonomy.taxeditor.preferences.colorDefinition.searchView.focus"
- label="%colorDefinition.label.12"
- value="0, 0, 0">
- </colorDefinition>
<fontDefinition
categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.searchView"
id="eu.etaxonomy.taxeditor.preferences.fontDefinition.searchView.accepted"
%fontDefinition.description.1
</description>
</fontDefinition>
- <colorDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.detailsView"
- id="eu.etaxonomy.taxeditor.preferences.colorDefinition.parseError"
- label="%colorDefinition.label.13"
- value="255,0,0">
- </colorDefinition>
- <colorDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor"
- id="eu.etaxonomy.taxeditor.preferences.colorDefinition.disabledEditor"
- label="%colorDefinition.label.14"
- value="105,114,124">
- </colorDefinition>
- <colorDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory"
- id="eu.etaxonomy.taxeditor.preferences.colorDefinition.editorError"
- label="%colorDefinition.label.15"
- value="255,0,0">
- </colorDefinition>
</extension>
<extension
point="org.eclipse.core.expressions.propertyTesters">
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.ColorRegistry;
import org.eclipse.jface.resource.FontRegistry;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
return getFontRegistry().get(symbolicName);
}
- /**
- * Color registered to the plugin may be obtained with the Eclipse themeing
- * functionality. Thus colors are editable by the user via
- * Preferences->General->Appearance->Colors and Fonts
- *
- * @return the ColorRegistry for the current theme
- */
- public static ColorRegistry getColorRegistry() {
- return getCurrentTheme().getColorRegistry();
- }
-
public static Color getColor(String symbolicName) {
- return getColorRegistry().get(symbolicName);
+ return ColorResources.getColor(symbolicName);
}
public static IStatus executeOperation(final AbstractPostOperation operation, UISynchronize sync) {
--- /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.ColorRegistry;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.RGB;
+
+import eu.etaxonomy.taxeditor.preference.Resources;
+
+/**
+ *
+ * @author pplitzner
+ * @since Nov 1, 2017
+ *
+ */
+public class ColorResources {
+
+ private static ColorResources instance;
+
+ public static ColorResources getInstance(){
+ if(instance == null){
+ instance = new ColorResources();
+ }
+ return instance;
+ }
+
+ private static ColorRegistry colorRegistry;
+
+ public ColorRegistry getColorRegistry() {
+ if (colorRegistry == null) {
+ colorRegistry = new ColorRegistry();
+ initializeColorRegistry(colorRegistry);
+ }
+ return colorRegistry;
+ }
+
+ public static Color getColor(String key){
+ return getInstance().getColorRegistry().get(key);
+ }
+
+ protected void initializeColorRegistry(ColorRegistry registry) {
+ registerColor(registry, Resources.COLOR_COMPOSITE_BACKGROUND, 255,255,255);
+ registerColor(registry, Resources.COLOR_CONTROL_BACKGROUND, 220, 220, 220);
+ registerColor(registry, Resources.COLOR_CONTROL_SELECTED, 210, 210, 210);
+ registerColor(registry, Resources.COLOR_CONTROL_SELECTED_FOCUS, 232,242,254);
+ registerColor(registry, Resources.COLOR_COMPOSITE_IRRELEVANT, 241,139,18);
+ registerColor(registry, Resources.SEARCH_VIEW_FOREGROUND, 192, 192, 192);
+ registerColor(registry, Resources.SEARCH_VIEW_FOCUS, 0, 0, 0);
+ registerColor(registry, Resources.COLOR_LIST_BACKGROUND, 150,150,150);
+ registerColor(registry, Resources.COLOR_FONT_DEFAULT, 0,0,0);
+ registerColor(registry, Resources.COLOR_TEXT_DISABLED, 150,150,150);
+ registerColor(registry, Resources.COLOR_TEXT_DISABLED_BACKGROUND, 230,230,230);
+ registerColor(registry, Resources.COLOR_DRAG_ENTER, 185,255,133);
+ registerColor(registry, Resources.COLOR_LIST_EVEN, 255,255,255);
+ registerColor(registry, Resources.COLOR_LIST_ODD, 230,230,230);
+ registerColor(registry, Resources.COLOR_PARSE_ERROR, 255,0,0);
+ registerColor(registry, Resources.COLOR_DISABLED_EDITOR, 105,114,124);
+ registerColor(registry, Resources.COLOR_EDITOR_ERROR, 255,0,0);
+ }
+
+ private void registerColor(ColorRegistry registry, String key,
+ int red, int green, int blue) {
+ registry.put(key, new RGB(red, green, blue));
+ }
+}