Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Replace (or extend) CTRL+F functionality in CNF
Replace (or extend) CTRL+F functionality in CNF [message #911466] Tue, 11 September 2012 13:01 Go to next message
Craig Petre is currently offline Craig Petre
Messages: 24
Registered: April 2011
Junior Member
In my RPC application I have my own navigator which extends CommonNavigator and I was trying to figure out how I could extend or replace the default functionality of CTRL+F (while the navigator is focused). This brings up a small textbox in the lower right corner of the navigator and allows you to do live searching of the nodes in the tree. I would like to have more control over how this search is performed in my navigator, but have not been able to figure out how to go about this. The textbox itself seems a bit unusual in that I can't find any information on it with plugin spy or SWT spy, which is why I've been having a hard time figuring out what code is responsible for it. Any ideas?

Thanks!
Re: Replace (or extend) CTRL+F functionality in CNF [message #915594 is a reply to message #911466] Mon, 17 September 2012 11:51 Go to previous message
Craig Petre is currently offline Craig Petre
Messages: 24
Registered: April 2011
Junior Member
This behavior turns out not to be a result of CTRL+F, but rather a result of typing anything into the navigator causes the search box to show up. I wasn't able to figure out how to hook into this search behavior, but I was able to figure out how to disable it and add my own handler.

To add a handler for CTRL+F to the common navigator you extend "org.eclipse.ui.commands" with a command using "org.eclipse.ui.edit.findReplace" as an ID and define your own handler. Next I added a KeyListener to the Tree which is part of the CommonViewer (<your common navigator object>.getCommonViewer().getTree().addKeyListener) and in there I added similar handling code to spawn my own search box and then set the KeyEvent's "doit" value to false so the eclipse default handler would not also attempt to run (the annoying search box in the bottom right of the navigator). I'm sure you could probably find the handler causing the search box and remove it from one of the controls under the CommonViewer, but setting "doit" to false worked for me.
Previous Topic:org.eclipse.e4.core.di.InjectionException: org.eclipse.core.runtime.AssertionFailedException:
Next Topic:Perspective customizations not being respected
Goto Forum:
  


Current Time: Fri May 24 05:38:45 EDT 2013

Powered by FUDForum. Page generated in 0.01592 seconds