From 12f71b097551e2a7260bccc0b55530ab9bf90206 Mon Sep 17 00:00:00 2001 From: Patrick Plitzner Date: Mon, 29 Jun 2015 16:01:34 +0200 Subject: [PATCH] Add icon for switching to advanced media view --- .../icons/switch_view_type-16x16-32.gif | Bin 0 -> 1032 bytes .../taxeditor/model/ImageResources.java | 5 +++++ .../ui/section/media/MediaMetaElement.java | 3 ++- .../ui/section/media/MediaViewSwitch.java | 4 +++- 4 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 eu.etaxonomy.taxeditor.store/icons/switch_view_type-16x16-32.gif diff --git a/eu.etaxonomy.taxeditor.store/icons/switch_view_type-16x16-32.gif b/eu.etaxonomy.taxeditor.store/icons/switch_view_type-16x16-32.gif new file mode 100644 index 0000000000000000000000000000000000000000..c7e0ebd6ca4b789cddb4676535f8646df38ad2ff GIT binary patch literal 1032 zcmZ?wbhEHb6krfw_&%Kh2)MX7BqYQnCB@a$R16IbjEoFTOpHuTjm^wVtgI|-ZLJvu zYCS#OeSExpeSQ4>ef|CY0s{OZBO{`sB4c8rVq&7>;$o7M6H`GbDJ3N-H6=McB{?lE zB|SYgJtsReGb1Z2GdnvgFE1xAFE>9Qi1G>w@=J5eGK!0ei;GH1ic3pN%F0U1%1g`2 z%F4^j>I>@X>T2rhYU}IkZZk04VPJT`!0=pF;Z;=3$FLCbJ_fOVhVVU7iQ7CYE=4vp z)VG~UWYFzkFqm!o#s!vth&f)oV8Z!N!dnHUYurO zfB*jd|NqawfB*jf2crL=h#Uo^hk)Ww7O*BA5DCf?3>;4xxc6LOaB6K66%sL-DcHi& zF3uVdGt1+n|5Wd0jzE`#4=*j2F@F)0#oXFINwrI@=tai~Ha^+u4@?&BIB{XApuF0- zn}&gXQw+pBHXJz6=Gx_LFBI$4bi7ZvOT_gA!==N=W!YT%ay}Y0vUGB$$DLSl*_mUp zqU#x#j~u2gE-R-0NI9vjCOLLAPSE_ALL="collapse_all" */ public static final String COLLAPSE_ALL = "collapse_all"; + public static final String SWITCH_VIEW_TYPE = "switch_view_type"; + + //derivative icons public static final String TISSUE_SAMPLE_DERIVATE = "tissue_sample_derivate"; public static final String TISSUE_SAMPLE_DERIVATE_CHARACTER_DATA = "tissue_sample_derivate_character_data"; public static final String DNA_SAMPLE_DERIVATE = "dna_sample_derivate"; @@ -333,6 +336,8 @@ public class ImageResources { "lock.png"); registerImage(registry, LOCK_OPEN_ICON, "lock_open.png"); + registerImage(registry, SWITCH_VIEW_TYPE, + "switch_view_type-16x16-32.gif"); registerImage(registry, DNA_SAMPLE_DERIVATE, "dna_derivate-16x16-32.png"); registerImage(registry, DNA_SAMPLE_DERIVATE_CHARACTER_DATA, diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaMetaElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaMetaElement.java index aa51d3605..517e9cfd3 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaMetaElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaMetaElement.java @@ -14,6 +14,7 @@ import eu.etaxonomy.cdm.model.agent.AgentBase; import eu.etaxonomy.cdm.model.common.LanguageString; import eu.etaxonomy.cdm.model.media.Media; import eu.etaxonomy.taxeditor.model.AbstractUtility; +import eu.etaxonomy.taxeditor.model.ImageResources; import eu.etaxonomy.taxeditor.store.CdmStore; import eu.etaxonomy.taxeditor.ui.dialog.selection.MediaSelectionDialog; import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection; @@ -47,8 +48,8 @@ public class MediaMetaElement extends AbstractEntityCollectionElement imp public void createControls(ICdmFormElement element, int style) { final IAction switchAction = MediaViewSwitch.createSwitch(MediaMetaElement.this); Button btnToggleAdvancedMediaView = new Button(getBox(), style); - btnToggleAdvancedMediaView.setText(switchAction.getText()); btnToggleAdvancedMediaView.setToolTipText(switchAction.getText()); + btnToggleAdvancedMediaView.setImage(ImageResources.getImage(ImageResources.SWITCH_VIEW_TYPE)); btnToggleAdvancedMediaView.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaViewSwitch.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaViewSwitch.java index 0506ebfa8..ce598fbad 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaViewSwitch.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaViewSwitch.java @@ -12,6 +12,8 @@ package eu.etaxonomy.taxeditor.ui.section.media; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IAction; +import eu.etaxonomy.taxeditor.model.ImageResources; + /** * Adds a switch to a section with an {@link ITogglableMediaElement} * to allow switching between simple and advanced media view @@ -28,7 +30,7 @@ public class MediaViewSwitch { public static IAction createSwitch(final ITogglableMediaElement togglableMediaElement) { final String label = "Change View Type"; - Action switchAction = new Action(label, IAction.AS_PUSH_BUTTON) { + Action switchAction = new Action(label, ImageResources.getImageDescriptor(ImageResources.SWITCH_VIEW_TYPE)) { @Override public void run() { if(togglableMediaElement!=null){ -- 2.30.2