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 21:53 Go to next message
Alex Kipling is currently offline Alex KiplingFriend
Messages: 258
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 07:19 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 1431
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 07:29 Go to previous messageGo to next message
Alexander Becher is currently offline Alexander BecherFriend
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 10:19 Go to previous message
Alex Kipling is currently offline Alex KiplingFriend
Messages: 258
Registered: July 2012
Senior Member
Thnx Dirk!
Thnx Alexander , it was very helpful!

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

Report message to a moderator

Previous Topic:column header with multiple rows
Next Topic:Freeze a tree column
Goto Forum:
  


Current Time: Wed Dec 17 21:28:08 GMT 2014

Powered by FUDForum. Page generated in 0.05813 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software