3 * Copyright (C) 2017 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.view
.e4
.details
;
12 import javax
.inject
.Inject
;
13 import javax
.inject
.Named
;
15 import org
.eclipse
.e4
.core
.di
.annotations
.Optional
;
16 import org
.eclipse
.e4
.ui
.model
.application
.ui
.basic
.MPart
;
17 import org
.eclipse
.e4
.ui
.services
.IServiceConstants
;
18 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
19 import org
.eclipse
.jface
.viewers
.StructuredSelection
;
20 import org
.eclipse
.swt
.widgets
.Composite
;
22 import eu
.etaxonomy
.cdm
.api
.conversation
.IConversationEnabled
;
23 import eu
.etaxonomy
.cdm
.model
.description
.Feature
;
24 import eu
.etaxonomy
.taxeditor
.l10n
.Messages
;
25 import eu
.etaxonomy
.taxeditor
.model
.FeatureNodeContainer
;
26 import eu
.etaxonomy
.taxeditor
.model
.IPartContentHasDetails
;
27 import eu
.etaxonomy
.taxeditor
.view
.e4
.AbstractCdmDataViewerE4
;
28 import eu
.etaxonomy
.taxeditor
.view
.e4
.AbstractCdmEditorPartE4
;
29 import eu
.etaxonomy
.taxeditor
.workbench
.WorkbenchUtility
;
36 public class DetailsPartE4
extends AbstractCdmEditorPartE4
{
39 public DetailsPartE4() {
46 protected AbstractCdmDataViewerE4
createViewer(Composite parent
) {
47 return new DetailsViewerE4(parent
, this);
52 public void selectionChanged(
53 @Named(IServiceConstants
.ACTIVE_SELECTION
)Object selection
,
54 @Named(IServiceConstants
.ACTIVE_PART
)MPart activePart
,
56 if(activePart
==thisPart
){
64 Object partObject
= activePart
;
65 Object wrappedPart
= WorkbenchUtility
.getE4WrappedPart(activePart
);
66 if(wrappedPart
!=null){
67 partObject
= wrappedPart
;
70 IStructuredSelection structuredSelection
;
71 if(!(selection
instanceof IStructuredSelection
)){
72 structuredSelection
= new StructuredSelection(selection
);
75 structuredSelection
= (IStructuredSelection
) selection
;
77 if(structuredSelection
.isEmpty()){
81 if(partObject
instanceof IPartContentHasDetails
){
82 if(partObject
instanceof IConversationEnabled
&& ((IConversationEnabled
) partObject
).getConversationHolder()==null) {
83 //TODO show specific message (refactor EmptyElement to allow specific messages)
87 // do not show details for feature nodes TODO strange check to avoid having shown the distribution map for every FeatureNodeContainer
88 if(structuredSelection
.getFirstElement() instanceof FeatureNodeContainer
){
89 // do show the map for distributions
90 Feature feature
= ((FeatureNodeContainer
) ((IStructuredSelection
) selection
).getFirstElement()).getFeature();
91 if(!feature
.equals(Feature
.DISTRIBUTION())){
96 showViewer(structuredSelection
, activePart
);
107 protected String
getViewName(){
108 return Messages
.DetailsViewPart_VIEWER_NAME
;