2 * Copyright (C) 2015 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
.media
;
11 import org
.eclipse
.jface
.action
.Action
;
12 import org
.eclipse
.jface
.action
.IAction
;
14 import eu
.etaxonomy
.taxeditor
.model
.ImageResources
;
17 * Adds a switch to a section with an {@link ITogglableMediaElement}
18 * to allow switching between simple and advanced media view
23 public class MediaViewSwitch
{
26 * Creates an {@link IAction} for the given {@link ITogglableMediaElement}
27 * that switches between the two states of the element.
29 public static IAction
createSwitch(final ITogglableMediaElement togglableMediaElement
) {
30 final String label
= "Change View Type";
32 Action switchAction
= new Action(label
, ImageResources
.getImageDescriptor(ImageResources
.SWITCH_VIEW_TYPE
)) {
35 if(togglableMediaElement
!=null){
36 togglableMediaElement
.toggleAdvancedMediaView();
40 switchAction
.setToolTipText(label
);