1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2017 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
package eu.etaxonomy.taxeditor.bulkeditor.e4;
|
11
|
|
12
|
import java.net.URISyntaxException;
|
13
|
import java.net.URL;
|
14
|
|
15
|
import org.eclipse.core.runtime.FileLocator;
|
16
|
import org.eclipse.core.runtime.IPath;
|
17
|
import org.eclipse.core.runtime.Path;
|
18
|
import org.eclipse.jface.viewers.LabelProvider;
|
19
|
import org.eclipse.swt.graphics.Image;
|
20
|
|
21
|
import eu.etaxonomy.taxeditor.bulkeditor.internal.TaxeditorBulkeditorPlugin;
|
22
|
import eu.etaxonomy.taxeditor.model.ImageResources;
|
23
|
|
24
|
/**
|
25
|
* @author pplitzner
|
26
|
* @date 11.09.2017
|
27
|
*
|
28
|
*/
|
29
|
public class BulkEditorLabelProvider extends LabelProvider {
|
30
|
|
31
|
/**
|
32
|
* {@inheritDoc}
|
33
|
*/
|
34
|
@Override
|
35
|
public Image getImage(Object element) {
|
36
|
AnnotatedTableItem item = (AnnotatedTableItem)element;
|
37
|
try {
|
38
|
if(item.isMergeCandidate()){
|
39
|
IPath path = new Path("icons/merge_candidate.gif"); //$NON-NLS-1$
|
40
|
URL url = FileLocator.find(TaxeditorBulkeditorPlugin.getDefault().getBundle(), path, null);
|
41
|
return ImageResources.getImage(url.toURI());
|
42
|
}
|
43
|
else if(item.isMergeTarget()){
|
44
|
IPath path = new Path("icons/merge_target.gif"); //$NON-NLS-1$
|
45
|
URL url = FileLocator.find(TaxeditorBulkeditorPlugin.getDefault().getBundle(), path, null);
|
46
|
return ImageResources.getImage(url.toURI());
|
47
|
}
|
48
|
} catch (URISyntaxException e) {
|
49
|
return null;
|
50
|
}
|
51
|
return null;
|
52
|
}
|
53
|
|
54
|
/**
|
55
|
* {@inheritDoc}
|
56
|
*/
|
57
|
@Override
|
58
|
public String getText(Object element) {
|
59
|
return super.getText(element);
|
60
|
}
|
61
|
|
62
|
}
|