Revision 0e327bed
Added by Patrick Plitzner over 9 years ago
- moved toggle button to the top-right corner of the Media(Specimen)Section (#3339)
- Changed label
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/MediaDetailsSection.java | ||
---|---|---|
10 | 10 |
|
11 | 11 |
package eu.etaxonomy.taxeditor.ui.section.description; |
12 | 12 |
|
13 |
import org.eclipse.jface.action.Action; |
|
14 |
import org.eclipse.jface.action.IAction; |
|
15 |
import org.eclipse.jface.action.ToolBarManager; |
|
13 | 16 |
import org.eclipse.jface.viewers.ISelectionProvider; |
17 |
import org.eclipse.swt.SWT; |
|
18 |
import org.eclipse.swt.widgets.Control; |
|
14 | 19 |
import org.eclipse.ui.forms.widgets.ExpandableComposite; |
15 | 20 |
import org.eclipse.ui.forms.widgets.TableWrapLayout; |
16 | 21 |
|
... | ... | |
61 | 66 |
|
62 | 67 |
} |
63 | 68 |
|
69 |
@Override |
|
70 |
protected Control createToolbar() { |
|
71 |
ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT); |
|
72 |
|
|
73 |
final String label; |
|
74 |
if(element_media.isAdvancedMediaView()){ |
|
75 |
label = "Use simple media view"; |
|
76 |
} |
|
77 |
else{ |
|
78 |
label = "Use advanced media view"; |
|
79 |
} |
|
80 |
|
|
81 |
Action addAction = new Action("Use advanced media view", IAction.AS_PUSH_BUTTON) { |
|
82 |
/* (non-Javadoc) |
|
83 |
* @see org.eclipse.jface.action.Action#run() |
|
84 |
*/ |
|
85 |
@Override |
|
86 |
public void run() { |
|
87 |
element_media.toggleAdvancedMediaView(); |
|
88 |
} |
|
89 |
}; |
|
90 |
addAction.setToolTipText(label); |
|
91 |
|
|
92 |
toolBarManager.add(addAction); |
|
93 |
|
|
94 |
return toolBarManager.createControl(this); |
|
95 |
} |
|
96 |
|
|
64 | 97 |
/** |
65 | 98 |
* <p>setEntity</p> |
66 | 99 |
* |
... | ... | |
74 | 107 |
element_media = (MediaMetaElement) formFactory.createEntityCollectionElement(this, entity, null, null, ExpandableComposite.EXPANDED); |
75 | 108 |
super.setEntity(entity); |
76 | 109 |
setSectionTitle(); |
110 |
setTextClient(createToolbar()); |
|
77 | 111 |
layout(); |
78 | 112 |
} |
79 | 113 |
|
Also available in: Unified diff