3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
11 package eu
.etaxonomy
.taxeditor
.editor
.view
.concept
;
13 import java
.util
.HashSet
;
16 import org
.eclipse
.jface
.viewers
.IStructuredContentProvider
;
17 import org
.eclipse
.jface
.viewers
.Viewer
;
19 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
20 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationship
;
21 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationshipType
;
22 import eu
.etaxonomy
.taxeditor
.editor
.TaxonEditorInput
;
26 * @created Jan 24, 2011
29 public class ConceptContentProvider
implements IStructuredContentProvider
{
32 * @see org.eclipse.jface.viewers.IContentProvider#dispose()
35 public void dispose() {
36 // TODO Auto-generated method stub
41 * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
44 public void inputChanged(Viewer viewer
, Object oldInput
, Object newInput
) {
45 // TODO Auto-generated method stub
50 * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
53 public Object
[] getElements(Object inputElement
) {
54 if(inputElement
instanceof TaxonEditorInput
){
55 Taxon taxon
= ((TaxonEditorInput
) inputElement
).getTaxon();
57 Set
<TaxonRelationship
> filteredTaxonRelations
= new HashSet
<TaxonRelationship
>();
59 for (TaxonRelationship relationship
: taxon
.getTaxonRelations()) {
60 if (! relationship
.getType().equals(TaxonRelationshipType
.MISAPPLIED_NAME_FOR()) ||
61 relationship
.getType().equals(TaxonRelationshipType
.TAXONOMICALLY_INCLUDED_IN())) {
62 filteredTaxonRelations
.add(relationship
);
66 return filteredTaxonRelations
.toArray();