1 package org.simantics.browsing.ui.nattable;
\r
3 import org.eclipse.nebula.widgets.nattable.NatTable;
\r
4 import org.eclipse.nebula.widgets.nattable.layer.LabelStack;
\r
5 import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
\r
6 import org.eclipse.nebula.widgets.nattable.ui.matcher.CellEditorMouseEventMatcher;
\r
7 import org.eclipse.swt.events.MouseEvent;
\r
9 public class SelectedCellEditorMatcher extends CellEditorMouseEventMatcher{
\r
11 public SelectedCellEditorMatcher( String regionLabel) {
\r
15 ILayerCell previous;
\r
16 int previousTime = 0;
\r
18 public boolean matches(NatTable natTable, MouseEvent event, LabelStack regionLabels) {
\r
19 if (super.matches(natTable, event, regionLabels)) {
\r
20 int px = natTable.getColumnPositionByX(event.x);
\r
21 int py = natTable.getRowPositionByY(event.y);
\r
22 ILayerCell cell = natTable.getCellByPosition(px,py);
\r
23 int time = event.time;
\r
24 if (previous != null &&
\r
25 cell.getColumnIndex() == previous.getColumnIndex() &&
\r
26 cell.getRowIndex() == previous.getRowIndex() &&
\r
27 time - previousTime > event.display.getDoubleClickTime())
\r
30 previousTime = time;
\r