Revision fdf07285
Added by Katja Luther almost 7 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/supplementaldata/SupplementalDataViewPart.java | ||
---|---|---|
9 | 9 |
|
10 | 10 |
package eu.etaxonomy.taxeditor.view.supplementaldata; |
11 | 11 |
|
12 |
import java.util.Set; |
|
13 |
|
|
12 | 14 |
import org.eclipse.jface.viewers.ISelection; |
13 | 15 |
import org.eclipse.jface.viewers.IStructuredSelection; |
14 | 16 |
import org.eclipse.jface.viewers.StructuredSelection; |
17 |
import org.eclipse.jface.viewers.StructuredViewerInternals; |
|
15 | 18 |
import org.eclipse.jface.viewers.TreeNode; |
16 | 19 |
import org.eclipse.jface.viewers.Viewer; |
17 | 20 |
import org.eclipse.swt.widgets.Composite; |
... | ... | |
21 | 24 |
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade; |
22 | 25 |
import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifResponse; |
23 | 26 |
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode; |
27 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
|
28 |
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship; |
|
29 |
import eu.etaxonomy.taxeditor.editor.ITaxonEditor; |
|
24 | 30 |
import eu.etaxonomy.taxeditor.l10n.Messages; |
25 | 31 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
26 | 32 |
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer; |
... | ... | |
75 | 81 |
} |
76 | 82 |
|
77 | 83 |
IStructuredSelection structuredSelection = (IStructuredSelection) selection; |
78 |
|
|
84 |
|
|
79 | 85 |
if((partObject instanceof EditorPart || partObject instanceof IPartContentHasSupplementalData)) { |
80 | 86 |
if(structuredSelection.size() != 1){ |
81 | 87 |
showEmptyPage(); |
82 | 88 |
return; |
83 | 89 |
} |
84 |
|
|
90 |
if (partObject instanceof ITaxonEditor && structuredSelection.getFirstElement() instanceof Taxon ){ |
|
91 |
if (((ITaxonEditor)partObject).getTaxon() != structuredSelection.getFirstElement() && ((Taxon)structuredSelection.getFirstElement()).isMisapplication()){ |
|
92 |
Set<TaxonRelationship> rels =((Taxon)structuredSelection.getFirstElement()).getTaxonRelations(((ITaxonEditor)partObject).getTaxon()); |
|
93 |
if (rels.size() == 1){ |
|
94 |
structuredSelection = new StructuredSelection(rels.iterator().next()); |
|
95 |
}else{ |
|
96 |
showEmptyPage(); |
|
97 |
return; |
|
98 |
} |
|
99 |
|
|
100 |
} |
|
101 |
} |
|
85 | 102 |
// do not show supplemental data for feature nodes |
86 | 103 |
if(structuredSelection.getFirstElement() instanceof FeatureNodeContainer){ |
87 | 104 |
showEmptyPage(); |
... | ... | |
98 | 115 |
} |
99 | 116 |
else if(structuredSelection.getFirstElement() instanceof GbifResponse){ |
100 | 117 |
structuredSelection = new StructuredSelection(((GbifResponse)structuredSelection.getFirstElement()).getDerivedUnitFacade().innerDerivedUnit()); |
101 |
} |
|
118 |
} |
|
119 |
|
|
102 | 120 |
showViewer(partObject, structuredSelection); |
103 | 121 |
}else{ |
104 | 122 |
showEmptyPage(); |
Also available in: Unified diff
ref #6390: supplemental data view for missapplied names