1
2
3
4
5
6
7
8
9
10
11 package de.jaret.util.ui.table.util.action;
12
13 import org.eclipse.jface.action.Action;
14
15 import de.jaret.util.ui.table.JaretTable;
16 import de.jaret.util.ui.table.model.IJaretTableSelection;
17 import de.jaret.util.ui.table.model.IRow;
18
19 /***
20 * Action that registers all selected rows for optimization of their respective heights.
21 *
22 * @author Peter Kliem
23 * @version $Id: OptimizeRowHeightAction.java 179 2007-01-07 17:37:50Z olk $
24 */
25 public class OptimizeRowHeightAction extends Action {
26 protected JaretTable _table;
27
28 public OptimizeRowHeightAction(JaretTable table) {
29 _table = table;
30 }
31
32 @Override
33 public void run() {
34 IJaretTableSelection selection = _table.getSelectionModel().getSelection();
35 if (!selection.isEmpty() && selection.getSelectedRows().size() > 0) {
36 for (IRow row : selection.getSelectedRows()) {
37 _table.optimizeHeight(row);
38 }
39 }
40 }
41
42 @Override
43 public String getText() {
44 return "Optimal row height";
45 }
46 }