Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » CellEditor on DoubleCLick?
CellEditor on DoubleCLick? [message #1007877] Thu, 07 February 2013 16: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 #1007911 is a reply to message #1007877] Fri, 08 February 2013 02:19 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1265
Registered: July 2012
Senior Member
You need to register your own edit bindings. By default the DefaultEditBindings are registered via DefaultGridLayerConfiguration. And there the edit actions are binded against the first single click. You need to change this to registerFirstDoubleClickBinding(), then it should only open on double click. Remember that you have to avoid registering the default configuration.
Re: CellEditor on DoubleCLick? [message #1007913 is a reply to message #1007877] Fri, 08 February 2013 02:29 Go to previous messageGo to next message
Alexander Becher is currently offline Alexander Becher
Messages: 4
Registered: July 2009
Junior Member
Try something like this:

addConfiguration(new DefaultEditBindings() {

	@Override
	public void configureUiBindings(UiBindingRegistry pUiBindingRegistry) {
		BodyCellEditorMouseEventMatcher mouseEventMatcher = new BodyCellEditorMouseEventMatcher(
				DelegatingCellEditor.class) {

			@Override
			public boolean matches(NatTable pNatTable,
					MouseEvent pEvent, LabelStack pRegionLabels) {
				if (pEvent != null && pEvent.button == 1) {
					return super.matches(pNatTable, pEvent,
							pRegionLabels);
				}
				return false;
			}

		};
		pUiBindingRegistry.registerDoubleClickBinding(
				mouseEventMatcher, new MouseEditAction());
		pUiBindingRegistry.registerFirstMouseDragMode(
				mouseEventMatcher, new CellEditDragMode());
		
		pUiBindingRegistry.registerKeyBinding(new SpecialCharacterKeyEventMatcher(),  new SpecialCharacterKeyEditAction());
		
		
	}

});


Cheers

Alex
Re: CellEditor on DoubleCLick? [message #1007936 is a reply to message #1007911] Fri, 08 February 2013 05:19 Go to previous message
Alex Kipling is currently offline Alex Kipling
Messages: 250
Registered: July 2012
Senior Member
Thnx Dirk!
Thnx Alexander , it was very helpful!

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

Report message to a moderator

Previous Topic:Scroll listener?
Next Topic:column header with multiple rows
Goto Forum:
  


Current Time: Mon Sep 01 19:30:21 EDT 2014

Powered by FUDForum. Page generated in 0.02089 seconds