Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » PatternFilter and CNF
PatternFilter and CNF [message #795530] Fri, 10 February 2012 10:27 Go to next message
Eclipse UserFriend
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 09:47 Go to previous messageGo to next message
Eclipse UserFriend
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 10:42 Go to previous message
Eclipse UserFriend
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: Tue May 20 00:45:12 EDT 2025

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

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

Back to the top