Revision 7a0547ca
Added by Patrick Plitzner over 10 years ago
- enabled DescriptiveView (Factual Data) to show descriptions of SpecimenOrObservationBase
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptiveViewPart.java | ||
---|---|---|
20 | 20 |
import org.eclipse.jface.action.MenuManager; |
21 | 21 |
import org.eclipse.jface.resource.ImageDescriptor; |
22 | 22 |
import org.eclipse.jface.viewers.ISelection; |
23 |
import org.eclipse.jface.viewers.ITreeContentProvider;
|
|
23 |
import org.eclipse.jface.viewers.IStructuredSelection;
|
|
24 | 24 |
import org.eclipse.jface.viewers.StructuredSelection; |
25 | 25 |
import org.eclipse.jface.viewers.TreeViewer; |
26 | 26 |
import org.eclipse.jface.viewers.Viewer; |
... | ... | |
32 | 32 |
import org.eclipse.swt.widgets.Control; |
33 | 33 |
import org.eclipse.swt.widgets.Menu; |
34 | 34 |
import org.eclipse.swt.widgets.Tree; |
35 |
import org.eclipse.ui.IEditorInput; |
|
36 |
import org.eclipse.ui.IEditorPart; |
|
37 | 35 |
import org.eclipse.ui.IWorkbenchActionConstants; |
38 | 36 |
import org.eclipse.ui.IWorkbenchPart; |
39 | 37 |
|
40 | 38 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
41 | 39 |
import eu.etaxonomy.cdm.model.description.DescriptionBase; |
42 | 40 |
import eu.etaxonomy.cdm.model.description.DescriptionElementBase; |
43 |
import eu.etaxonomy.cdm.model.description.TaxonDescription; |
|
44 |
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor; |
|
45 |
import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor; |
|
46 |
import eu.etaxonomy.taxeditor.editor.definedterm.DefinedTermEditor; |
|
47 |
import eu.etaxonomy.taxeditor.editor.key.AbstractGraphKeyEditor; |
|
41 |
import eu.etaxonomy.cdm.model.description.IDescribable; |
|
48 | 42 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
49 | 43 |
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer; |
50 | 44 |
import eu.etaxonomy.taxeditor.model.FeatureNodeContainerTree; |
51 | 45 |
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails; |
46 |
import eu.etaxonomy.taxeditor.model.IPartContentHasFactualData; |
|
52 | 47 |
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData; |
53 | 48 |
import eu.etaxonomy.taxeditor.model.ImageResources; |
54 | 49 |
import eu.etaxonomy.taxeditor.view.AbstractCdmEditorViewPart; |
50 |
import eu.etaxonomy.taxeditor.view.detail.DetailsViewPart; |
|
51 |
import eu.etaxonomy.taxeditor.view.supplementaldata.SupplementalDataViewPart; |
|
55 | 52 |
|
56 | 53 |
/** |
57 | 54 |
* <p>DescriptiveViewPart class.</p> |
... | ... | |
67 | 64 |
|
68 | 65 |
protected TreeViewer viewer; |
69 | 66 |
|
70 |
/** |
|
71 |
* Maps {@link FeatureNodeContainerTree} to their corresponding {@link TaxonDescritpion}.<br> |
|
72 |
* This serves as input for the {@link ITreeContentProvider} of the {@link TreeViewer} |
|
73 |
*/ |
|
74 |
protected Map<TaxonDescription, FeatureNodeContainerTree> featureNodeContainerCache = new HashMap<TaxonDescription, FeatureNodeContainerTree>(); |
|
67 |
protected Map<DescriptionBase<?>, FeatureNodeContainerTree> featureNodeContainerCache = new HashMap<DescriptionBase<?>, FeatureNodeContainerTree>(); |
|
75 | 68 |
|
76 | 69 |
protected ToggleDescriptionAction showAllElementsAction; |
77 | 70 |
|
... | ... | |
157 | 150 |
return; |
158 | 151 |
} |
159 | 152 |
|
160 |
if(part instanceof BulkEditor){ |
|
161 |
showEmptyPage(); |
|
162 |
return; |
|
153 |
if(part == this){ |
|
154 |
return; |
|
163 | 155 |
} |
164 |
|
|
165 |
if(part instanceof AbstractGraphKeyEditor){ |
|
166 |
showEmptyPage(); |
|
167 |
return; |
|
156 |
if(part instanceof DetailsViewPart || part instanceof SupplementalDataViewPart){ |
|
157 |
// do not show empty page as these views are also used to edit the description selected in this view |
|
158 |
return; |
|
168 | 159 |
} |
169 | 160 |
|
170 |
if(part instanceof DefinedTermEditor){ |
|
171 |
showEmptyPage(); |
|
172 |
return; |
|
161 |
if(selection instanceof IStructuredSelection |
|
162 |
&& ((IStructuredSelection) selection).getFirstElement() instanceof IDescribable<?> |
|
163 |
&& part instanceof IPartContentHasFactualData){ |
|
164 |
featureNodeContainerCache.clear(); |
|
165 |
showViewer(part, (IStructuredSelection) selection); |
|
166 |
return; |
|
173 | 167 |
} |
174 |
|
|
175 |
if(part instanceof MultiPageTaxonEditor){ |
|
176 |
if(! part.equals(this.part)){ |
|
177 |
IEditorInput input = ((IEditorPart) part).getEditorInput(); |
|
178 |
featureNodeContainerCache.clear(); |
|
179 |
showViewer(part, new StructuredSelection(input)); |
|
180 |
} |
|
168 |
else{ |
|
169 |
showEmptyPage(); |
|
181 | 170 |
} |
182 | 171 |
} |
183 | 172 |
|
Also available in: Unified diff