Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » PatternFilter and CNF
PatternFilter and CNF [message #795530] Fri, 10 February 2012 15:27 Go to next message
Bert Van Kets is currently offline Bert Van KetsFriend
Messages: 3
Registered: February 2012
Junior Member
Hi all,

I'm building an RCP application and using a Common Navigator Framework tree in a view.
I want to add a PatternFilter but can't get it to work properly. Adding the filter to the CommonViewer seems to work, but when ever I want to change the search string it seems the old filter remains in place, even when I change the search string on the existing PatternFilter.
The search string is provided by a Text component I added to the view. The filtering is triggered by an addKeyListener on the Text component.

Filtering in the ContentProvider is not an option as the content for this CNF is provided by different bundles, not the bundle the navigator is defined in.

I have looked high and low, but can't find an example on how to add pattern filtering to a CNF implementation.
Anybody got any hints?

Thanks

Bert
Re: PatternFilter and CNF [message #811576 is a reply to message #795530] Fri, 02 March 2012 14:47 Go to previous messageGo to next message
Bert Van Kets is currently offline Bert Van KetsFriend
Messages: 3
Registered: February 2012
Junior Member
I found the solution

		filterString = filterInput.getText();
		CommonViewer cv = getCommonViewer();
		if (pf == null)	{
			pf = new PatternFilter();
			pf.setIncludeLeadingWildcard(true);
			pf.setPattern(filterString);
			cv.addFilter(pf);
		} else {
			pf.setPattern(filterString);
			cv.refresh(false);
		}


filterInput is a Text input.
Works like a charm.
Re: PatternFilter and CNF [message #811609 is a reply to message #811576] Fri, 02 March 2012 15:42 Go to previous message
Harutyun Arzumanian is currently offline Harutyun ArzumanianFriend
Messages: 35
Registered: February 2012
Member
Nice job dude!
Previous Topic:After JDT refactoring tomcat wouldnot start
Next Topic:How to neatly format if..else without an else-if
Goto Forum:
  


Current Time: Thu Apr 18 13:41:45 GMT 2024

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

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

Back to the top