Project

General

Profile

Revision 127f0e03

ID127f0e037d4f1bb483712e5dfaae2c9b424880fe
Parent 3ee27021
Child 21cbdd69

Added by Katja Luther about 2 years ago

move mediaToggleButton to the top

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/MediaDetailsSection.java
9 9

  
10 10
package eu.etaxonomy.taxeditor.ui.section.description;
11 11

  
12
import org.eclipse.jface.action.ToolBarManager;
12 13
import org.eclipse.jface.viewers.ISelectionProvider;
14
import org.eclipse.swt.SWT;
15
import org.eclipse.swt.widgets.Control;
13 16
import org.eclipse.ui.forms.widgets.ExpandableComposite;
14 17

  
15 18
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
......
19 22
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
20 23
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
21 24
import eu.etaxonomy.taxeditor.ui.section.media.MediaMetaElement;
25
import eu.etaxonomy.taxeditor.ui.section.media.MediaViewSwitch;
22 26

  
23 27
/**
24 28
 * <p>MediaDetailsSection class.</p>
......
59 63
	protected AbstractCdmDetailElement<Media> createCdmDetailElement(AbstractCdmDetailSection<Media> parentElement, int style) {
60 64
	    return null;
61 65
	}
66

  
67

  
68

  
69
    @Override
70
    protected Control createToolbar() {
71
        ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
72
        toolBarManager.add(MediaViewSwitch.createSwitch(mediaMetaElement));
73
        return toolBarManager.createControl(this);
74
    }
75

  
62 76
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaMetaElement.java
5 5

  
6 6
import java.util.Map;
7 7

  
8
import org.eclipse.jface.action.IAction;
9 8
import org.eclipse.swt.SWT;
10
import org.eclipse.swt.events.SelectionAdapter;
11
import org.eclipse.swt.events.SelectionEvent;
12 9
import org.eclipse.swt.events.SelectionListener;
13
import org.eclipse.swt.widgets.Button;
14 10
import org.eclipse.swt.widgets.Display;
15 11

  
16 12
import eu.etaxonomy.cdm.common.CdmUtils;
......
22 18
import eu.etaxonomy.cdm.model.common.TimePeriod;
23 19
import eu.etaxonomy.cdm.model.media.Media;
24 20
import eu.etaxonomy.taxeditor.model.AbstractUtility;
25
import eu.etaxonomy.taxeditor.model.ImageResources;
26 21
import eu.etaxonomy.taxeditor.store.CdmStore;
27 22
import eu.etaxonomy.taxeditor.ui.dialog.selection.MediaSelectionDialog;
28 23
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
......
68 63
    /** {@inheritDoc} */
69 64
    @Override
70 65
    public void createControls(ICdmFormElement element, int style) {
71
        final IAction switchAction = MediaViewSwitch.createSwitch(MediaMetaElement.this);
72
        Button btnToggleAdvancedMediaView = new Button(getBox(), style);
73
        btnToggleAdvancedMediaView.setToolTipText(switchAction.getText());
74
        btnToggleAdvancedMediaView.setImage(ImageResources.getImage(ImageResources.SWITCH_VIEW_TYPE));
75
        btnToggleAdvancedMediaView.addSelectionListener(new SelectionAdapter() {
76
            @Override
77
            public void widgetSelected(SelectionEvent e) {
78
                switchAction.run();
79
            }
80
        });
66
//        final IAction switchAction = MediaViewSwitch.createSwitch(MediaMetaElement.this);
67
//        Button btnToggleAdvancedMediaView = new Button(getBox(), style);
68
//        btnToggleAdvancedMediaView.setToolTipText(switchAction.getText());
69
//        btnToggleAdvancedMediaView.setImage(ImageResources.getImage(ImageResources.SWITCH_VIEW_TYPE));
70
//        btnToggleAdvancedMediaView.addSelectionListener(new SelectionAdapter() {
71
//            @Override
72
//            public void widgetSelected(SelectionEvent e) {
73
//                switchAction.run();
74
//            }
75
//        });
81 76
        setWarnForReferencingObjects(element, 2);
82 77
        text_title = formFactory.createLanguageStringWithLabelElement(element, "Title", null, style);
83 78
        selection_artist = formFactory.createSelectionElement(AgentBase.class, //getConversationHolder(),
......
175 170
                    warnForReferencedObjects.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
176 171
                    warnForReferencedObjects.setLayout(LayoutConstants.FILL(2, 3));
177 172
                    warnForReferencedObjects.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
178

  
179 173
                }
180 174
            }
181 175
        }
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaSection.java
93 93
        return true;
94 94
    }
95 95

  
96

  
96 97
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)