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
.supplementaldata
;
13 import org
.eclipse
.jface
.viewers
.ISelection
;
14 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
15 import org
.eclipse
.jface
.viewers
.StructuredSelection
;
16 import org
.eclipse
.jface
.viewers
.Viewer
;
17 import org
.eclipse
.swt
.widgets
.Composite
;
18 import org
.eclipse
.ui
.IWorkbenchPart
;
19 import org
.eclipse
.ui
.part
.EditorPart
;
21 import eu
.etaxonomy
.cdm
.api
.facade
.DerivedUnitFacade
;
22 import eu
.etaxonomy
.cdm
.model
.description
.PolytomousKeyNode
;
23 import eu
.etaxonomy
.taxeditor
.model
.AbstractUtility
;
24 import eu
.etaxonomy
.taxeditor
.model
.FeatureNodeContainer
;
25 import eu
.etaxonomy
.taxeditor
.model
.IPartContentHasSupplementalData
;
26 import eu
.etaxonomy
.taxeditor
.view
.AbstractCdmEditorViewPart
;
30 * <p>SupplementalDataViewPart class.</p>
33 * @created Jun 10, 2010
36 public class SupplementalDataViewPart
extends AbstractCdmEditorViewPart
{
38 /** Constant <code>ID="eu.etaxonomy.taxeditor.editor.view.supp"{trunked}</code> */
39 public static final String ID
= "eu.etaxonomy.taxeditor.view.supplementalData";
41 private SupplementalDataViewer viewer
;
44 * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
48 public void createViewer(Composite parent
) {
49 viewer
= new SupplementalDataViewer(parent
, this);
55 public void selectionChanged(IWorkbenchPart part
, ISelection selection
) {
56 if(AbstractUtility
.getActiveEditor() == null){
65 if(!(selection
instanceof IStructuredSelection
)){
69 IStructuredSelection structuredSelection
= (IStructuredSelection
) selection
;
71 if((part
instanceof EditorPart
|| part
instanceof IPartContentHasSupplementalData
)) {
72 if(structuredSelection
.size() != 1){
77 // do not show supplemental data for feature nodes
78 if(structuredSelection
.getFirstElement() instanceof FeatureNodeContainer
){
82 else if(structuredSelection
.getFirstElement() instanceof DerivedUnitFacade
){
85 else if(structuredSelection
.getFirstElement() instanceof PolytomousKeyNode
){
86 structuredSelection
= new StructuredSelection(((PolytomousKeyNode
)structuredSelection
.getFirstElement()).getKey());
88 showViewer(part
, structuredSelection
);
96 public void dispose() {
98 selectionService
.removePostSelectionListener(this);
104 public Viewer
getViewer() {
114 public boolean onComplete() {
115 // TODO Auto-generated method stub