1 package org.simantics.browsing.ui.nattable;
\r
3 import org.eclipse.nebula.widgets.nattable.config.AbstractUiBindingConfiguration;
\r
4 import org.eclipse.nebula.widgets.nattable.edit.action.CellEditDragMode;
\r
5 import org.eclipse.nebula.widgets.nattable.edit.action.KeyEditAction;
\r
6 import org.eclipse.nebula.widgets.nattable.edit.action.MouseEditAction;
\r
7 import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
\r
8 import org.eclipse.nebula.widgets.nattable.painter.cell.CheckBoxPainter;
\r
9 import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer;
\r
10 import org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry;
\r
11 import org.eclipse.nebula.widgets.nattable.ui.matcher.CellEditorMouseEventMatcher;
\r
12 import org.eclipse.nebula.widgets.nattable.ui.matcher.CellPainterMouseEventMatcher;
\r
13 import org.eclipse.nebula.widgets.nattable.ui.matcher.KeyEventMatcher;
\r
14 import org.eclipse.nebula.widgets.nattable.ui.matcher.LetterOrDigitKeyEventMatcher;
\r
15 import org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher;
\r
16 import org.eclipse.swt.SWT;
\r
18 public class GEEditBindings extends AbstractUiBindingConfiguration {
\r
21 public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
\r
22 // configure the space key to activate a cell editor via keyboard
\r
23 // this is especially useful for changing the value for a checkbox
\r
24 uiBindingRegistry.registerKeyBinding(
\r
25 new KeyEventMatcher(SWT.NONE, 32),
\r
26 new KeyEditAction());
\r
27 uiBindingRegistry.registerKeyBinding(
\r
28 new KeyEventMatcher(SWT.NONE, SWT.F2),
\r
29 new KeyEditAction());
\r
30 uiBindingRegistry.registerKeyBinding(
\r
31 new LetterOrDigitKeyEventMatcher(),
\r
32 new KeyEditAction());
\r
33 uiBindingRegistry.registerKeyBinding(
\r
34 new LetterOrDigitKeyEventMatcher(SWT.MOD2),
\r
35 new KeyEditAction());
\r
37 uiBindingRegistry.registerSingleClickBinding(
\r
38 new SelectedCellEditorMatcher(GridRegion.BODY),
\r
39 new MouseEditAction());
\r
41 uiBindingRegistry.registerMouseDragMode(
\r
42 new CellEditorMouseEventMatcher(GridRegion.BODY),
\r
43 new CellEditDragMode());
\r
45 uiBindingRegistry.registerFirstSingleClickBinding(
\r
46 new CellPainterMouseEventMatcher(GridRegion.BODY, MouseEventMatcher.LEFT_BUTTON, CheckBoxPainter.class),
\r
47 new MouseEditAction());
\r
49 uiBindingRegistry.registerFirstMouseDragMode(
\r
50 new CellPainterMouseEventMatcher(GridRegion.BODY, MouseEventMatcher.LEFT_BUTTON, CheckBoxPainter.class),
\r
51 new CellEditDragMode());
\r