Revision 1c5d598c
Added by Patrick Plitzner over 7 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/derivative/OccurrenceView.java | ||
---|---|---|
9 | 9 |
*/ |
10 | 10 |
package eu.etaxonomy.taxeditor.view.derivative; |
11 | 11 |
|
12 |
import java.util.Collection; |
|
13 |
|
|
12 | 14 |
import org.eclipse.jface.action.MenuManager; |
13 | 15 |
import org.eclipse.jface.viewers.AbstractTreeViewer; |
14 | 16 |
import org.eclipse.jface.viewers.ISelection; |
17 |
import org.eclipse.jface.viewers.IStructuredSelection; |
|
15 | 18 |
import org.eclipse.jface.viewers.TreeViewer; |
16 | 19 |
import org.eclipse.swt.SWT; |
17 | 20 |
import org.eclipse.swt.layout.GridData; |
... | ... | |
24 | 27 |
import org.eclipse.ui.IWorkbenchPart; |
25 | 28 |
import org.eclipse.ui.part.ViewPart; |
26 | 29 |
|
30 |
import eu.etaxonomy.cdm.api.service.IOccurrenceService; |
|
31 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
|
32 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
|
33 |
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails; |
|
34 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
27 | 35 |
import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateContentProvider; |
28 | 36 |
import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateLabelProvider; |
29 | 37 |
|
... | ... | |
32 | 40 |
* @date Oct 7, 2015 |
33 | 41 |
* |
34 | 42 |
*/ |
35 |
public class OccurrenceView extends ViewPart implements ISelectionListener{ |
|
43 |
public class OccurrenceView extends ViewPart implements ISelectionListener, IPartContentHasDetails{
|
|
36 | 44 |
|
37 | 45 |
public static String ID = "eu.etaxonomy.taxeditor.view.derivative.OccurrenceView"; |
38 | 46 |
|
... | ... | |
97 | 105 |
*/ |
98 | 106 |
@Override |
99 | 107 |
public void selectionChanged(IWorkbenchPart part, ISelection selection) { |
100 |
System.out.println(selection); |
|
108 |
if(selection instanceof IStructuredSelection){ |
|
109 |
Object selectedElement = ((IStructuredSelection) selection).getFirstElement(); |
|
110 |
if(selectedElement instanceof Taxon){ |
|
111 |
Collection<SpecimenOrObservationBase> fieldUnits = CdmStore.getService(IOccurrenceService.class).listFieldUnitsByAssociatedTaxon((Taxon) selectedElement, null, null); |
|
112 |
viewer.setInput(fieldUnits); |
|
113 |
} |
|
114 |
} |
|
101 | 115 |
} |
102 | 116 |
} |
Also available in: Unified diff
Listen to taxon selection