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
.editor
.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
.editor
.EditorUtil
;
23 import eu
.etaxonomy
.taxeditor
.editor
.MultiPageTaxonEditor
;
24 import eu
.etaxonomy
.taxeditor
.editor
.Page
;
25 import eu
.etaxonomy
.taxeditor
.editor
.name
.TaxonNameEditor
;
26 import eu
.etaxonomy
.taxeditor
.editor
.view
.AbstractCdmEditorViewPart
;
27 import eu
.etaxonomy
.taxeditor
.model
.AbstractCdmViewPart
;
28 import eu
.etaxonomy
.taxeditor
.model
.FeatureNodeContainer
;
29 import eu
.etaxonomy
.taxeditor
.model
.IPartContentHasSupplementalData
;
32 * <p>DetailsViewPart class.</p>
35 * @created Jun 10, 2010
38 public class DetailsViewPart
extends AbstractCdmEditorViewPart
implements IPartContentHasSupplementalData
{
40 /** Constant <code>ID="eu.etaxonomy.taxeditor.editor.forms.det"{trunked}</code> */
41 public static String ID
= "eu.etaxonomy.taxeditor.editor.forms.detailsView";
43 private DetailsViewer viewer
;
47 public void createViewer(Composite parent
) {
48 //selectionService.addPostSelectionListener(this);
50 viewer
= new DetailsViewer(parent
, this);
51 getSite().setSelectionProvider(viewer
);
55 public void selectionChanged(IWorkbenchPart part
, ISelection selection
) {
56 if(EditorUtil
.getActiveEditor() == null){
65 if(!(selection
instanceof IStructuredSelection
)){
69 if((part
instanceof IEditorPart
) || (part
instanceof AbstractCdmViewPart
)) {
70 if(((IStructuredSelection
) selection
).size() != 1){
75 // do not show details for feature nodes TODO really?
76 if(((IStructuredSelection
) selection
).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
, selection
);
92 * <p>getDetailsViewer</p>
94 * @return a {@link eu.etaxonomy.taxeditor.editor.view.detail.DetailsViewer} object.
96 public DetailsViewer
getDetailsViewer() {
97 return (DetailsViewer
) getViewer();
102 public void changed(Object object
) {
103 super.changed(object
);
104 if(part
instanceof MultiPageTaxonEditor
){
105 MultiPageTaxonEditor editor
= (MultiPageTaxonEditor
) part
;
107 TaxonNameEditor page
= (TaxonNameEditor
) editor
.getPage(Page
.NAME
);
108 page
.getSelectedObject().refresh();
115 public boolean postOperation(CdmBase objectAffectedByOperation
) {
118 viewer
.setInput(objectAffectedByOperation
);
120 return super.postOperation(objectAffectedByOperation
);
125 public Viewer
getViewer() {
132 public void dispose() {
134 selectionService
.removePostSelectionListener(this);
142 public boolean onComplete() {
143 // TODO Auto-generated method stub