Revision cc30ce42
Added by Patrick Plitzner over 6 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/graph/ConceptGraphContentProvider.java | ||
---|---|---|
1 | 1 |
/** |
2 |
*
|
|
2 |
* |
|
3 | 3 |
*/ |
4 | 4 |
package eu.etaxonomy.taxeditor.editor.view.concept.graph; |
5 | 5 |
|
6 |
import java.util.Set; |
|
7 | 6 |
import java.util.HashMap; |
8 | 7 |
import java.util.Map; |
9 | 8 |
|
10 | 9 |
import org.eclipse.jface.viewers.Viewer; |
11 | 10 |
import org.eclipse.zest.core.viewers.IGraphContentProvider; |
12 | 11 |
|
13 |
|
|
14 |
|
|
15 | 12 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
16 | 13 |
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship; |
17 | 14 |
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType; |
18 |
import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
|
|
15 |
import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInputE4;
|
|
19 | 16 |
|
20 | 17 |
/** |
21 |
* @author andreas
|
|
18 |
* @author andreas |
|
22 | 19 |
* |
23 | 20 |
*/ |
24 | 21 |
public class ConceptGraphContentProvider implements IGraphContentProvider { |
... | ... | |
62 | 59 |
*/ |
63 | 60 |
@Override |
64 | 61 |
public Object[] getElements(Object inputElement) { |
65 |
if(inputElement instanceof TaxonEditorInput){ |
|
66 |
Taxon taxon = ((TaxonEditorInput) inputElement).getTaxon(); |
|
62 |
if(inputElement instanceof TaxonEditorInputE4){
|
|
63 |
Taxon taxon = ((TaxonEditorInputE4) inputElement).getTaxon();
|
|
67 | 64 |
|
68 | 65 |
Map<String, TaxonRelationship> filteredTaxonRelations = new HashMap<String, TaxonRelationship>(); |
69 | 66 |
getTaxonRelationshipsRecursive(filteredTaxonRelations, taxon); |
70 |
|
|
67 |
|
|
71 | 68 |
return filteredTaxonRelations.values().toArray(); |
72 | 69 |
} |
73 | 70 |
return new Object[0]; |
... | ... | |
78 | 75 |
// eu.etaxonomy.taxeditor.model; |
79 | 76 |
// see also ConceptContentProvider |
80 | 77 |
for (TaxonRelationship relationship : taxon.getTaxonRelations()) { |
81 |
|
|
78 |
|
|
82 | 79 |
if (!relationship.getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR()) |
83 | 80 |
&& !relationship.getType().equals(TaxonRelationshipType.INVALID_DESIGNATION_FOR()) |
84 | 81 |
&& !relationship.getType().equals(TaxonRelationshipType.TAXONOMICALLY_INCLUDED_IN())) { |
85 |
|
|
82 |
|
|
86 | 83 |
if(!relationship.getToTaxon().equals(taxon)){ |
87 | 84 |
continue; |
88 | 85 |
} |
89 |
|
|
86 |
|
|
90 | 87 |
String key = relationship.getFromTaxon().getUuid().toString() + relationship.getType().getUuid(); |
91 | 88 |
if(!filteredTaxonRelations.containsKey(key)) { |
92 |
filteredTaxonRelations.put(key, relationship);
|
|
89 |
filteredTaxonRelations.put(key, relationship); |
|
93 | 90 |
Taxon toTaxon = relationship.getToTaxon(); |
94 | 91 |
if(toTaxon != null){ |
95 | 92 |
getTaxonRelationshipsRecursive(filteredTaxonRelations, toTaxon); |
96 |
|
|
93 |
|
|
97 | 94 |
} |
98 | 95 |
} |
99 | 96 |
} |
100 |
|
|
101 |
|
|
97 |
|
|
98 |
|
|
102 | 99 |
} |
103 |
|
|
104 |
|
|
100 |
|
|
101 |
|
|
105 | 102 |
} |
106 | 103 |
|
107 | 104 |
} |
Also available in: Unified diff
ref #6925 Add generic ExpandHandler