2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
9 package eu
.etaxonomy
.taxeditor
.ui
.section
.description
;
11 import org
.eclipse
.jface
.action
.ToolBarManager
;
12 import org
.eclipse
.jface
.viewers
.ISelectionProvider
;
13 import org
.eclipse
.swt
.SWT
;
14 import org
.eclipse
.swt
.widgets
.Control
;
15 import org
.eclipse
.ui
.forms
.widgets
.ExpandableComposite
;
17 import eu
.etaxonomy
.cdm
.model
.media
.Media
;
18 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
19 import eu
.etaxonomy
.taxeditor
.ui
.element
.ICdmFormElement
;
20 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailElement
;
21 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailSection
;
22 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaMetaElement
;
23 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaViewSwitch
;
27 * @created Jun 15, 2010
29 public class MediaDetailsSection
extends AbstractCdmDetailSection
<Media
> {
31 private MediaMetaElement mediaMetaElement
;
33 public MediaDetailsSection(CdmFormFactory formFactory
,
34 ICdmFormElement parentElement
,
35 ISelectionProvider selectionProvider
, int style
) {
36 super(formFactory
, parentElement
, selectionProvider
, style
);
40 public void setEntity(Media entity
) {
41 if(mediaMetaElement
!= null){
42 this.removeElements();
44 mediaMetaElement
= (MediaMetaElement
) formFactory
.createEntityCollectionElement(this, entity
, null, null, ExpandableComposite
.EXPANDED
);
45 super.setEntity(entity
);
47 setTextClient(createToolbar());
52 public void setMediaSectionTitle() {
53 this.setSectionTitle();
57 public String
getHeading() {
62 protected AbstractCdmDetailElement
<Media
> createCdmDetailElement(AbstractCdmDetailSection
<Media
> parentElement
, int style
) {
67 protected Control
createToolbar() {
68 ToolBarManager toolBarManager
= new ToolBarManager(SWT
.FLAT
);
69 toolBarManager
.add(MediaViewSwitch
.createSwitch(mediaMetaElement
));
70 return toolBarManager
.createControl(this);