<commit_before>/*******************************************************************************
 * File: PathSelectionUiBinding.java
 * 
 * Date: 2014/08/10
 * Author: <NAME>
 * 
 * Copyright (c) 2014 Original authors and others.
 * 
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * <a href="http://www.eclipse.org/legal/epl-v10.html">epl-v1.0</a>
 *
 * Contributors:
 * <NAME> - initial API and implementation
 *******************************************************************************/
package cane.brothers.e4.commander.pathTable.config;

import org.eclipse.nebula.widgets.nattable.selection.config.RowOnlySelectionBindings;
import org.eclipse.nebula.widgets.nattable.ui.action.IKeyAction;
import org.eclipse.nebula.widgets.nattable.ui.action.NoOpMouseAction;
import org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry;
import org.eclipse.nebula.widgets.nattable.ui.matcher.KeyEventMatcher;
import org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher;
import org.eclipse.swt.SWT;

import cane.brothers.e4.commander.pathTable.action.OpenPathAction;
import cane.brothers.e4.commander.pathTable.action.OpenPathMouseClickAction;
import cane.brothers.e4.commander.pathTable.action.ViewportSelectFirstPathAction;

/**
 * Path row selection binding
 *
 */
public class PathSelectionUiBinding extends RowOnlySelectionBindings {

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

	// press Enter
	configureEnterBindings(uiBindingRegistry, new OpenPathAction());
    }

    // add Enter key binding
    protected void configureEnterBindings(UiBindingRegistry uiBindingRegistry,
	    IKeyAction action) {
	uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE,
		SWT.CR), action);
	uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.MOD1,
		SWT.CR), action);
    }

    @Override
    protected void configureBodyMouseClickBindings(
	    UiBindingRegistry uiBindingRegistry) {

	super.configureBodyMouseClickBindings(uiBindingRegistry);

	// added NoOpMouseAction on single click because of Bug 428901
	uiBindingRegistry.registerFirstSingleClickBinding(
		MouseEventMatcher.bodyLeftClick(SWT.NONE),
		new NoOpMouseAction());

	uiBindingRegistry.registerDoubleClickBinding(
		MouseEventMatcher.bodyLeftClick(SWT.NONE),
		new OpenPathMouseClickAction());
    }

    @Override
    protected void configureColumnHeaderMouseClickBindings(
	    UiBindingRegistry uiBindingRegistry) {

	uiBindingRegistry.registerSingleClickBinding(
		MouseEventMatcher.columnHeaderLeftClick(SWT.NONE),
		new ViewportSelectFirstPathAction());

	uiBindingRegistry.registerSingleClickBinding(
		MouseEventMatcher.columnHeaderLeftClick(SWT.MOD1),
		new ViewportSelectFirstPathAction());
    }

    @Override
    protected void configureRowHeaderMouseClickBindings(
	    UiBindingRegistry uiBindingRegistry) {
    }

}<commit_msg>28: click on column header select first path entry  Task-Url: http://github.com/webcane/EclipseCommander/issues/issue/28<commit_after>/*******************************************************************************
 * File: PathSelectionUiBinding.java
 * 
 * Date: 2014/08/10
 * Author: <NAME>
 * 
 * Copyright (c) 2014 Original authors and others.
 * 
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * <a href="http://www.eclipse.org/legal/epl-v10.html">epl-v1.0</a>
 *
 * Contributors:
 * <NAME> - initial API and implementation
 *******************************************************************************/
package cane.brothers.e4.commander.pathTable.config;

import org.eclipse.nebula.widgets.nattable.selection.config.RowOnlySelectionBindings;
import org.eclipse.nebula.widgets.nattable.ui.action.IKeyAction;
import org.eclipse.nebula.widgets.nattable.ui.action.NoOpMouseAction;
import org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry;
import org.eclipse.nebula.widgets.nattable.ui.matcher.KeyEventMatcher;
import org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher;
import org.eclipse.swt.SWT;

import cane.brothers.e4.commander.pathTable.action.OpenPathAction;
import cane.brothers.e4.commander.pathTable.action.OpenPathMouseClickAction;
import cane.brothers.e4.commander.pathTable.action.ViewportSelectFirstPathAction;

/**
 * Path row selection binding
 *
 */
public class PathSelectionUiBinding extends RowOnlySelectionBindings {

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

	// press Enter
	configureEnterBindings(uiBindingRegistry, new OpenPathAction());
    }

    // add Enter key binding
    protected void configureEnterBindings(UiBindingRegistry uiBindingRegistry,
	    IKeyAction action) {
	uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE,
		SWT.CR), action);
	uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.MOD1,
		SWT.CR), action);
    }

    @Override
    protected void configureBodyMouseClickBindings(
	    UiBindingRegistry uiBindingRegistry) {

	super.configureBodyMouseClickBindings(uiBindingRegistry);

	// added NoOpMouseAction on single click because of Bug 428901
	uiBindingRegistry.registerFirstSingleClickBinding(
		MouseEventMatcher.bodyLeftClick(SWT.NONE),
		new NoOpMouseAction());

	uiBindingRegistry.registerDoubleClickBinding(
		MouseEventMatcher.bodyLeftClick(SWT.NONE),
		new OpenPathMouseClickAction());
    }

    @Override
    protected void configureColumnHeaderMouseClickBindings(
	    UiBindingRegistry uiBindingRegistry) {

	uiBindingRegistry.registerSingleClickBinding(
		MouseEventMatcher.columnHeaderLeftClick(SWT.NONE),
		new ViewportSelectFirstPathAction());

	uiBindingRegistry.registerSingleClickBinding(
		MouseEventMatcher.columnHeaderLeftClick(SWT.MOD1),
		new ViewportSelectFirstPathAction());
    }
}
{'fraction_non_alphanumeric': 0.13462163039948036, 'fraction_numerical': 0.01039298473530367, 'mean_word_length': 5.858574610244989, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1896646', 'n_tokens_mistral': 1826, 'n_tokens_neox': 1683, 'n_words': 314}