2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.editor
.view
.concept
;
12 import java
.util
.HashMap
;
15 import org
.eclipse
.jface
.viewers
.IStructuredContentProvider
;
16 import org
.eclipse
.jface
.viewers
.Viewer
;
18 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
19 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationship
;
20 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationshipType
;
24 * @created Jan 24, 2011
27 public class ConceptContentProvider
implements IStructuredContentProvider
{
30 public void dispose() {
35 public void inputChanged(Viewer viewer
, Object oldInput
, Object newInput
) {
39 public Object
[] getElements(Object inputElement
) {
41 if(inputElement
instanceof Taxon
){
42 taxon
= (Taxon
) inputElement
;
45 Map
<TaxonRelationship
, Taxon
> taxonToTaxonRelationsMap
= new HashMap
<>();
47 for (TaxonRelationship relationship
: taxon
.getTaxonRelations()) {
48 if (! relationship
.getType().equals(TaxonRelationshipType
.MISAPPLIED_NAME_FOR()) ||
49 relationship
.getType().equals(TaxonRelationshipType
.TAXONOMICALLY_INCLUDED_IN())) {
50 taxonToTaxonRelationsMap
.put(relationship
, taxon
);
53 return taxonToTaxonRelationsMap
.entrySet().toArray();