Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » CellEditor on DoubleCLick?
CellEditor on DoubleCLick? [message #1008020] Thu, 07 February 2013 21:53 Go to next message
Alex Kipling is currently offline Alex Kipling
Messages: 250
Registered: July 2012
Senior Member
The cellEditor is triggered on leftclick now.
Is it possible to trigger it on double click?
Re: CellEditor on DoubleCLick? [message #1008386 is a reply to message #1008020] Tue, 12 February 2013 09:30 Go to previous message
Renso Lohuis is currently offline Renso Lohuis
Messages: 44
Registered: July 2012
Member
You change the default edit bindings by finding the

DefaultEditBindings

And change it to your own and replace the single click binding by double click binding.

I did the same and mine looks like this: (I did some other changes as well to make sure that you also can edit with upper case and by pressing space)

public class ExtendedEditBindings extends AbstractUiBindingConfiguration {

	public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
		uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE, SWT.F2), new KeyEditAction());
		uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE, SWT.SPACE), new KeyEditAction());

		uiBindingRegistry.registerKeyBinding(new LetterOrDigitKeyEventMatcher(), new KeyEditAction());
		uiBindingRegistry.registerKeyBinding(new LetterOrDigitKeyEventMatcher(SWT.SHIFT), new KeyEditAction());

		uiBindingRegistry.registerDoubleClickBinding(new BodyCellEditorMouseEventMatcher(TextCellEditor.class), new MouseEditAction());

		uiBindingRegistry.registerDoubleClickBinding(new CellPainterMouseEventMatcher(
				GridRegion.BODY,
				MouseEventMatcher.LEFT_BUTTON,
				CheckBoxPainter.class), new MouseEditAction());

		uiBindingRegistry.registerDoubleClickBinding(new BodyCellEditorMouseEventMatcher(ComboBoxCellEditor.class), new MouseEditAction());

		uiBindingRegistry.registerDoubleClickBinding(
				new BodyCellEditorMouseEventMatcher(MultiComboBoxCellEditor.class),
				new MouseEditAction());

	}

}


Then find the DefaultGridLayerConfiguration change it to your own and add your own EditBindings

protected void addEditingUIConfig() {
	addConfiguration(new ExtendedEditBindings());
}


And use this as grid layer configuration

gridLayer.addConfiguration(new ExtendedGridLayerConfiguration(gridLayer));

[Updated on: Tue, 12 February 2013 09:31]

Report message to a moderator

Previous Topic:Using GroupByHeaderLayer
Next Topic:column header with multiple rows
Goto Forum:
  


Current Time: Wed Sep 03 02:26:33 GMT 2014

Powered by FUDForum. Page generated in 0.01602 seconds