X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.browsing.ui.nattable%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fnattable%2FSelectedCellEditorMatcher.java;fp=bundles%2Forg.simantics.browsing.ui.nattable%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fnattable%2FSelectedCellEditorMatcher.java;h=50e7b902468352f839bc765523bd8d0645f1c459;hp=4cf1e16beb9abc6b33b3dd03102252f62cd9bed2;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.browsing.ui.nattable/src/org/simantics/browsing/ui/nattable/SelectedCellEditorMatcher.java b/bundles/org.simantics.browsing.ui.nattable/src/org/simantics/browsing/ui/nattable/SelectedCellEditorMatcher.java index 4cf1e16be..50e7b9024 100644 --- a/bundles/org.simantics.browsing.ui.nattable/src/org/simantics/browsing/ui/nattable/SelectedCellEditorMatcher.java +++ b/bundles/org.simantics.browsing.ui.nattable/src/org/simantics/browsing/ui/nattable/SelectedCellEditorMatcher.java @@ -1,39 +1,39 @@ -package org.simantics.browsing.ui.nattable; - -import org.eclipse.nebula.widgets.nattable.NatTable; -import org.eclipse.nebula.widgets.nattable.layer.LabelStack; -import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell; -import org.eclipse.nebula.widgets.nattable.ui.matcher.CellEditorMouseEventMatcher; -import org.eclipse.swt.events.MouseEvent; - -public class SelectedCellEditorMatcher extends CellEditorMouseEventMatcher{ - - public SelectedCellEditorMatcher( String regionLabel) { - super(regionLabel); - } - - ILayerCell previous; - int previousTime = 0; - @Override - public boolean matches(NatTable natTable, MouseEvent event, LabelStack regionLabels) { - if (super.matches(natTable, event, regionLabels)) { - int px = natTable.getColumnPositionByX(event.x); - int py = natTable.getRowPositionByY(event.y); - ILayerCell cell = natTable.getCellByPosition(px,py); - int time = event.time; - if (previous != null && - cell.getColumnIndex() == previous.getColumnIndex() && - cell.getRowIndex() == previous.getRowIndex() && - time - previousTime > event.display.getDoubleClickTime()) - return true; - previous = cell; - previousTime = time; - } - return false; - } - - - - - -} +package org.simantics.browsing.ui.nattable; + +import org.eclipse.nebula.widgets.nattable.NatTable; +import org.eclipse.nebula.widgets.nattable.layer.LabelStack; +import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell; +import org.eclipse.nebula.widgets.nattable.ui.matcher.CellEditorMouseEventMatcher; +import org.eclipse.swt.events.MouseEvent; + +public class SelectedCellEditorMatcher extends CellEditorMouseEventMatcher{ + + public SelectedCellEditorMatcher( String regionLabel) { + super(regionLabel); + } + + ILayerCell previous; + int previousTime = 0; + @Override + public boolean matches(NatTable natTable, MouseEvent event, LabelStack regionLabels) { + if (super.matches(natTable, event, regionLabels)) { + int px = natTable.getColumnPositionByX(event.x); + int py = natTable.getRowPositionByY(event.y); + ILayerCell cell = natTable.getCellByPosition(px,py); + int time = event.time; + if (previous != null && + cell.getColumnIndex() == previous.getColumnIndex() && + cell.getRowIndex() == previous.getRowIndex() && + time - previousTime > event.display.getDoubleClickTime()) + return true; + previous = cell; + previousTime = time; + } + return false; + } + + + + + +}