3 * Copyright (C) 2007 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.
11 package eu
.etaxonomy
.taxeditor
.view
.detail
;
13 import org
.eclipse
.jface
.viewers
.ISelection
;
14 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
15 import org
.eclipse
.jface
.viewers
.Viewer
;
16 import org
.eclipse
.swt
.widgets
.Composite
;
17 import org
.eclipse
.ui
.IEditorPart
;
18 import org
.eclipse
.ui
.IWorkbenchPart
;
20 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
21 import eu
.etaxonomy
.cdm
.model
.description
.Feature
;
22 import eu
.etaxonomy
.taxeditor
.model
.AbstractUtility
;
23 import eu
.etaxonomy
.taxeditor
.model
.FeatureNodeContainer
;
24 import eu
.etaxonomy
.taxeditor
.model
.IPartContentHasDetails
;
25 import eu
.etaxonomy
.taxeditor
.model
.IPartContentHasSupplementalData
;
26 import eu
.etaxonomy
.taxeditor
.view
.AbstractCdmEditorViewPart
;
29 * <p>DetailsViewPart class.</p>
32 * @created Jun 10, 2010
35 public class DetailsViewPart
extends AbstractCdmEditorViewPart
implements IPartContentHasSupplementalData
{
37 /** Constant <code>ID="eu.etaxonomy.taxeditor.editor.forms.det"{trunked}</code> */
38 public static String ID
= "eu.etaxonomy.taxeditor.view.detail";
40 private DetailsViewer viewer
;
44 public void createViewer(Composite parent
) {
45 //selectionService.addPostSelectionListener(this);
47 viewer
= new DetailsViewer(parent
, this);
48 getSite().setSelectionProvider(viewer
);
53 public void selectionChanged(IWorkbenchPart part
, ISelection selection
) {
54 if(AbstractUtility
.getActiveEditor() == null){
63 if(!(selection
instanceof IStructuredSelection
)){
67 IStructuredSelection structuredSelection
= (IStructuredSelection
) selection
;
69 if((part
instanceof IEditorPart
) || (part
instanceof IPartContentHasDetails
)) {
70 if(structuredSelection
.size() != 1){
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())){
85 showViewer(part
, structuredSelection
);
93 public boolean postOperation(CdmBase objectAffectedByOperation
) {
95 viewer
.setInput(objectAffectedByOperation
);
97 return super.postOperation(objectAffectedByOperation
);
103 public Viewer
getViewer() {
110 public void dispose() {
112 selectionService
.removePostSelectionListener(this);
121 public boolean onComplete() {