3 * Copyright (C) 2013 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
.ui
.section
.occurrence
.media
;
12 import org
.eclipse
.jface
.action
.Action
;
13 import org
.eclipse
.jface
.action
.IAction
;
14 import org
.eclipse
.jface
.action
.ToolBarManager
;
15 import org
.eclipse
.jface
.viewers
.ISelectionProvider
;
16 import org
.eclipse
.swt
.SWT
;
17 import org
.eclipse
.swt
.widgets
.Control
;
19 import eu
.etaxonomy
.cdm
.api
.conversation
.ConversationHolder
;
20 import eu
.etaxonomy
.cdm
.model
.occurrence
.MediaSpecimen
;
21 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
22 import eu
.etaxonomy
.taxeditor
.ui
.element
.ICdmFormElement
;
23 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailElement
;
24 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailSection
;
31 public class MediaSpecimenGeneralDetailSection
extends AbstractCdmDetailSection
<MediaSpecimen
> {
33 private MediaSpecimenGeneralDetailElement mediaSpecimenGeneralDetailElement
;
38 * @param parentElement
39 * @param selectionProvider
42 public MediaSpecimenGeneralDetailSection(CdmFormFactory formFactory
,
43 ConversationHolder conversation
, ICdmFormElement parentElement
,
44 ISelectionProvider selectionProvider
, int style
) {
45 super(formFactory
, conversation
, parentElement
, selectionProvider
, style
);
50 * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading()
53 public String
getHeading() {
58 * @see org.eclipse.ui.forms.widgets.ExpandableComposite#setText(java.lang.String)
61 public void setText(String title
) {
62 // String text = null;
63 // if(getEntity()!=null && getEntity().getKindOfUnit()!=null){
64 // if(getEntity().getKindOfUnit().equals(DerivateLabelProvider.getArtworkTerm())){
67 // else if(getEntity().getKindOfUnit().equals(DerivateLabelProvider.getLivingPlantPhotoTerm())){
68 // text = "Living Plant Photo";
70 // else if(getEntity().getKindOfUnit().equals(DerivateLabelProvider.getSpecimenScanTerm())){
71 // text = "Specimen Scan";
73 // else if(getEntity().getKindOfUnit().equals(DerivateLabelProvider.getDetailImageTerm())){
74 // text = "Detail Image";
78 // super.setText(text);
86 protected Control
createToolbar() {
87 ToolBarManager toolBarManager
= new ToolBarManager(SWT
.FLAT
);
89 String actionLabel
= "Change View Type";
90 Action addAction
= new Action(actionLabel
, IAction
.AS_PUSH_BUTTON
) {
92 * @see org.eclipse.jface.action.Action#run()
96 mediaSpecimenGeneralDetailElement
.toogleAdvancedMediaView();
99 addAction
.setToolTipText(actionLabel
);
101 toolBarManager
.add(addAction
);
103 return toolBarManager
.createControl(this);
107 * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
110 protected AbstractCdmDetailElement
<MediaSpecimen
> createCdmDetailElement(AbstractCdmDetailSection
<MediaSpecimen
> parentElement
, int style
) {
111 mediaSpecimenGeneralDetailElement
= formFactory
.createMediaSpecimenGeneralDetailElement(parentElement
);
112 return mediaSpecimenGeneralDetailElement
;