Revision 2832a925
Added by Patrick Plitzner over 9 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewPart.java | ||
---|---|---|
48 | 48 |
getSite().setSelectionProvider(viewer); |
49 | 49 |
} |
50 | 50 |
|
51 |
/** {@inheritDoc} */ |
|
52 | 51 |
@Override |
53 |
public void selectionChanged(IWorkbenchPart part, ISelection selection) { |
|
54 |
if(AbstractUtility.getActiveEditor() == null){ |
|
55 |
showEmptyPage(); |
|
56 |
return; |
|
57 |
} |
|
58 |
|
|
59 |
if(part == this){ |
|
60 |
return; |
|
61 |
} |
|
62 |
|
|
63 |
if(!(selection instanceof IStructuredSelection)){ |
|
64 |
return; |
|
65 |
} |
|
66 |
|
|
67 |
IStructuredSelection structuredSelection = (IStructuredSelection) selection; |
|
68 |
|
|
69 |
if((part instanceof IEditorPart) || (part instanceof IPartContentHasDetails)) { |
|
70 |
if(structuredSelection.size() != 1){ |
|
71 |
showEmptyPage(); |
|
72 |
return; |
|
73 |
} |
|
74 |
|
|
75 |
// do not show details for feature nodes TODO really? |
|
76 |
if(structuredSelection.getFirstElement() instanceof FeatureNodeContainer){ |
|
77 |
// do show the map for distributions |
|
78 |
Feature feature = ((FeatureNodeContainer) ((IStructuredSelection) selection).getFirstElement()).getFeature(); |
|
79 |
if(!feature.equals(Feature.DISTRIBUTION())){ |
|
80 |
showEmptyPage(); |
|
81 |
return; |
|
82 |
} |
|
83 |
} |
|
84 |
|
|
85 |
showViewer(part, structuredSelection); |
|
86 |
}else{ |
|
87 |
showEmptyPage(); |
|
88 |
} |
|
52 |
protected void internal_selectionChanged(IWorkbenchPart part, ISelection selection){ |
|
53 |
if(AbstractUtility.getActiveEditor() == null){ |
|
54 |
showEmptyPage(); |
|
55 |
return; |
|
56 |
} |
|
57 |
|
|
58 |
if(part == this){ |
|
59 |
return; |
|
60 |
} |
|
61 |
|
|
62 |
if(!(selection instanceof IStructuredSelection)){ |
|
63 |
return; |
|
64 |
} |
|
65 |
|
|
66 |
IStructuredSelection structuredSelection = (IStructuredSelection) selection; |
|
67 |
|
|
68 |
if((part instanceof IEditorPart) || (part instanceof IPartContentHasDetails)) { |
|
69 |
if(structuredSelection.size() != 1){ |
|
70 |
showEmptyPage(); |
|
71 |
return; |
|
72 |
} |
|
73 |
|
|
74 |
// do not show details for feature nodes TODO really? |
|
75 |
if(structuredSelection.getFirstElement() instanceof FeatureNodeContainer){ |
|
76 |
// do show the map for distributions |
|
77 |
Feature feature = ((FeatureNodeContainer) ((IStructuredSelection) selection).getFirstElement()).getFeature(); |
|
78 |
if(!feature.equals(Feature.DISTRIBUTION())){ |
|
79 |
showEmptyPage(); |
|
80 |
return; |
|
81 |
} |
|
82 |
} |
|
83 |
|
|
84 |
showViewer(part, structuredSelection); |
|
85 |
}else{ |
|
86 |
showEmptyPage(); |
|
87 |
} |
|
88 |
} |
|
89 |
|
|
90 |
/* (non-Javadoc) |
|
91 |
* @see eu.etaxonomy.taxeditor.view.AbstractCdmViewPart#showEmptyPage() |
|
92 |
*/ |
|
93 |
@Override |
|
94 |
public void showEmptyPage() { |
|
95 |
viewer.setSelection(null); |
|
96 |
super.showEmptyPage(); |
|
89 | 97 |
} |
90 | 98 |
|
91 | 99 |
/** {@inheritDoc} */ |
Also available in: Unified diff
fix for #2754