1 package net.mograsim.plugin.tables.mi;
3 import java.util.Optional;
5 import org.eclipse.swt.widgets.Table;
7 import net.mograsim.plugin.tables.LazyTableViewer;
8 import net.mograsim.plugin.util.SingleSWTRequest;
10 public class RowHighlighter
12 private int highlighted = -1;
13 private LazyTableViewer viewer;
14 private FontAndColorHelper cProv;
15 private SingleSWTRequest requester = new SingleSWTRequest();
17 public RowHighlighter(LazyTableViewer viewer, FontAndColorHelper cProv)
23 public void highlight(int row)
25 requester.request(() ->
27 if (!viewer.getTable().isDisposed())
32 private void innerHighlight(int row)
34 Table table = viewer.getTable();
38 table.showItem(table.getItem(Math.min(table.getItemCount(), row + 2)));
39 table.showItem(table.getItem(row));
40 Optional.ofNullable(table.getItem(row).getData()).ifPresent(d -> viewer.update(d, null));
42 if (highlighted != -1)
43 Optional.ofNullable(table.getItem(highlighted).getData()).ifPresent(d -> viewer.update(d, null));