/**
 * 
 */
package org.corpus_tools.atomic.tokeneditor.configuration;

import org.corpus_tools.salt.common.SDocumentGraph;
import org.corpus_tools.salt.core.SNode;
import org.eclipse.nebula.widgets.nattable.NatTable;
import org.eclipse.nebula.widgets.nattable.selection.config.DefaultSelectionBindings;
import org.eclipse.nebula.widgets.nattable.ui.action.IKeyAction;
import org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry;
import org.eclipse.nebula.widgets.nattable.ui.matcher.IKeyEventMatcher;
import org.eclipse.swt.events.KeyEvent;

/**
 * TODO Description
 *
 * @author Stephan Druskat <mail@sdruskat.net>
 *
 */
public class TokenEditorSelectionBindings extends DefaultSelectionBindings {

	private final SDocumentGraph graph;

	/**
	 * @param graph
	 */
	public TokenEditorSelectionBindings(SDocumentGraph graph) {
		this.graph = graph;
	}

	@Override
	public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
		super.configureUiBindings(uiBindingRegistry);
		uiBindingRegistry.registerKeyBinding(new IKeyEventMatcher() {

			@Override
			public boolean matches(KeyEvent event) {
				if (event.keyCode == 'n') {
					return true;
				}
				return false;
			}
		}, new IKeyAction() {

			@Override
			public void run(NatTable natTable, KeyEvent event) {
				System.err.println("N gives us >" + graph.getText((SNode) natTable.getData("selectedToken")));

			}
		});
	}
}
@@ -121,49 +121,8 @@
 ph;%0A
-import org.corpus_tools.salt.core.SNode;%0A
 impo
@@ -448,17 +448,16 @@
 matcher.
-I
 KeyEvent
@@ -465,16 +465,44 @@
 atcher;%0A
+import org.eclipse.swt.SWT;%0A
 import o
@@ -858,21 +858,24 @@
 rride%0A%09p
-ublic
+rotected
  void co
@@ -873,34 +873,46 @@
 d void configure
-Ui
+PageDownButton
 Bindings(UiBindi
@@ -943,124 +943,78 @@
 stry
-) %7B%0A%09%09super.configureUiBindings(uiBindingRegistry);%0A%09%09uiBindingRegistry.registerKeyBinding(new IKeyEventMatcher
+, IKeyAction action) %7B%0A%09%09IKeyAction newAction = new IKeyAction
 () %7B%0A
+%09%09%09
 %0A%09%09%09
@@ -1037,326 +1037,671 @@
 lic 
-boolean matches(KeyEvent event) %7B%0A%09%09%09%09if (event.keyCode == 'n') %7B%0A%09%09%09%09%09return true
+void run(NatTable natTable, KeyEvent event) %7B%0A%09%09%09%09// FIXME: Implement new selection n steps to right%0A%09%09%09%09System.err.println(%22CUSTOM PAGE DOWN PRESSED!%22)
 ;%0A%09%09%09%09
-%7D
 %0A%09%09%09
-%09return false;%0A%09%09%09%7D%0A%09%09%7D,
+%7D%0A%09%09%7D;%0A        uiBindingRegistry.registerKeyBinding(%0A               
  new 
-I
 Key
-Action() %7B%0A%0A%09%09%09@Override%0A%09%09%09public void run(NatTable natTable, KeyEvent event) %7B%0A%09%09%09%09System.err.println(%22N gives us %3E%22 + graph.getText((SNode) natTable.getData(%22selectedToken%22)));%0A%0A%09%09%09%7D%0A%09%09%7D);%0A%09
+EventMatcher(SWT.NONE, SWT.PAGE_DOWN), newAction);%0A        uiBindingRegistry.registerKeyBinding(%0A                new KeyEventMatcher(SWT.MOD2, SWT.PAGE_DOWN), newAction);%0A        uiBindingRegistry.registerKeyBinding(%0A                new KeyEventMatcher(SWT.MOD1, SWT.PAGE_DOWN), newAction);%0A        uiBindingRegistry.registerKeyBinding(%0A                new KeyEventMatcher(SWT.MOD2 %7C SWT.MOD1, SWT.PAGE_DOWN), newAction);%0A    
 %7D%0A%7D

Remove unneeded override code, catch page down key in NatTable