3 * Copyright (C) 2015 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
.media
;
12 import org
.eclipse
.jface
.action
.Action
;
13 import org
.eclipse
.jface
.action
.IAction
;
16 * Adds a switch to a section with an {@link ITogglableMediaElement}
17 * to allow switching between simple and advanced media view
22 public class MediaViewSwitch
{
25 * Creates an {@link IAction} for the given {@link ITogglableMediaElement}
26 * that switches between the two states of the element.
28 public static IAction
createSwitch(final ITogglableMediaElement togglableMediaElement
) {
29 final String label
= "Change View Type";
31 Action switchAction
= new Action(label
, IAction
.AS_PUSH_BUTTON
) {
34 if(togglableMediaElement
!=null){
35 togglableMediaElement
.toggleAdvancedMediaView();
39 switchAction
.setToolTipText(label
);