1
|
/**
|
2
|
* Copyright (C) 2017 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
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.
|
8
|
*/
|
9
|
package eu.etaxonomy.taxeditor.ui.combo.taxon;
|
10
|
|
11
|
import java.util.ArrayList;
|
12
|
import java.util.Collection;
|
13
|
import java.util.List;
|
14
|
|
15
|
import org.eclipse.jface.viewers.IStructuredContentProvider;
|
16
|
|
17
|
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
|
18
|
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
|
19
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
20
|
|
21
|
/**
|
22
|
* @author pplitzner
|
23
|
* @since Nov 24, 2017
|
24
|
*
|
25
|
*/
|
26
|
public class TaxonNodeComboContentProvider implements IStructuredContentProvider {
|
27
|
|
28
|
@Override
|
29
|
public Object[] getElements(Object inputElement) {
|
30
|
Collection<TaxonNode> nodes = (Collection<TaxonNode>)inputElement;
|
31
|
List<TaxonNode> allNodes = new ArrayList<>();
|
32
|
nodes.forEach(node->{
|
33
|
allNodes.add(node);
|
34
|
allNodes.addAll(CdmStore.getService(ITaxonNodeService.class).loadChildNodesOfTaxonNode(node, null, true, null));
|
35
|
});
|
36
|
return allNodes.toArray();
|
37
|
}
|
38
|
|
39
|
}
|