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
);
52 protected void selectionChanged_internal(IWorkbenchPart part
, ISelection selection
){
53 if(AbstractUtility
.getActiveEditor() == null){
62 if(!(selection
instanceof IStructuredSelection
)){
66 IStructuredSelection structuredSelection
= (IStructuredSelection
) selection
;
68 if((part
instanceof IEditorPart
) || (part
instanceof IPartContentHasDetails
)) {
69 if(structuredSelection
.size() != 1){
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())){
84 showViewer(part
, structuredSelection
);
91 * @see eu.etaxonomy.taxeditor.view.AbstractCdmViewPart#showEmptyPage()
94 public void showEmptyPage() {
95 viewer
.setSelection(null);
96 super.showEmptyPage();
101 public boolean postOperation(CdmBase objectAffectedByOperation
) {
103 viewer
.setInput(objectAffectedByOperation
);
105 return super.postOperation(objectAffectedByOperation
);
111 public Viewer
getViewer() {
118 public void dispose() {
120 selectionService
.removePostSelectionListener(this);
129 public boolean onComplete() {