Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » Xviewer autofocus and expand tree(if i search an item and it is found has to be focus automatically.)
Xviewer autofocus and expand tree [message #1270295] Wed, 12 March 2014 20:32 Go to next message
Esteban Avila is currently offline Esteban AvilaFriend
Messages: 49
Registered: June 2012
Hi everybody,

I have been working with Xviewer and i want after a "Search" , if the item is in the tree, that it focus automatically in the item and if necessary made that node expand.

Do you have any idea how do this.


Re: Xviewer autofocus and expand tree [message #1336888 is a reply to message #1270295] Tue, 06 May 2014 16:14 Go to previous message
Donald Dunne is currently offline Donald DunneFriend
Messages: 194
Registered: July 2009
Senior Member

Having the matched item have focus might be possible, but it would take focus away from the filter box which might be odd for the user. What is the use case for this and how would you see it being used?

Regarding the expansion of children to match searches, you should be able to subclass XViewerTextFilter to provide for your use case. Here's an example.

public class XBranchTextFilter extends XViewerTextFilter {

public XBranchTextFilter(XViewer viewer) {

public boolean select(Viewer viewer, Object parentElement, Object element) {
if (element instanceof TransactionRecord) {
return true;
if (element instanceof ArrayList<?>) {
return true;
return, parentElement, element);


And then make sure that your Xviewer overrides the getXViewerTextFilter method

public XViewerTextFilter getXViewerTextFilter() {
return new XBranchTextFilter(this);
Previous Topic:SWT ComboViewer with ContentProposal and Pagination Control (large anmount of data)
Next Topic:missing feature org.eclipse.nebula.widgets.formattedtext
Goto Forum:

Current Time: Thu Feb 29 13:22:25 GMT 2024

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

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

Back to the top