Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.ui.dialogs
Class PatternFilter


java.lang.Object
  extended by 

org.eclipse.jface.viewers.ViewerFilter
      extended by 
org.eclipse.ui.dialogs.PatternFilter

public class PatternFilter
extends ViewerFilter

A filter used in conjunction with FilteredTree. In order to determine if a node should be filtered it uses the content and label provider of the tree to do pattern matching on its children. This causes the entire tree structure to be realized. Note that the label provider must implement ILabelProvider.

Since:
3.2
See Also:
FilteredTree

Constructor Summary
PatternFilter ()
           
 
Method Summary
  Object[] filter ( Viewer viewer, Object parent, Object[] elements)
          Filters the given elements for the given viewer.
 boolean isElementSelectable ( Object element)
          Answers whether the given element is a valid selection in the filtered tree.
 boolean isElementVisible ( Viewer viewer, Object element)
          Answers whether the given element in the given viewer matches the filter pattern.
protected  boolean isLeafMatch ( Viewer viewer, Object element)
          Check if the current (leaf) element is a match with the filter text.
protected  boolean isParentMatch ( Viewer viewer, Object element)
          Check if the parent (category) is a match to the filter text.
 boolean select ( Viewer viewer, Object parentElement, Object element)
          Returns whether the given element makes it through this filter.
 void setIncludeLeadingWildcard (boolean includeLeadingWildcard)
          Sets whether a leading wildcard should be attached to each pattern string.
 void setPattern ( String patternString)
          The pattern string for which this filter should select elements in the viewer.
protected  boolean wordMatches ( String text)
          Return whether or not if any of the words in text satisfy the match critera.
 
Methods inherited from class org.eclipse.jface.viewers. ViewerFilter
filter, isFilterProperty
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PatternFilter

public PatternFilter()
Method Detail

filter

public final 
Object[] filter(
Viewer viewer,
                             
Object parent,
                             
Object[] elements)
Description copied from class: ViewerFilter
Filters the given elements for the given viewer. The input array is not modified.

The default implementation of this method calls select on each element in the array, and returns only those elements for which select returns true.

Overrides:
filter in class ViewerFilter
Parameters:
viewer - the viewer
parent - the parent element
elements - the elements to filter
Returns:
the filtered elements

select

public final boolean select(
Viewer viewer,
                            
Object parentElement,
                            
Object element)
Description copied from class: ViewerFilter
Returns whether the given element makes it through this filter.

Specified by:
select in class ViewerFilter
Parameters:
viewer - the viewer
parentElement - the parent element
element - the element
Returns:
true if element is included in the filtered set, and false if excluded

setIncludeLeadingWildcard

public final void setIncludeLeadingWildcard(boolean includeLeadingWildcard)
Sets whether a leading wildcard should be attached to each pattern string.

Parameters:
includeLeadingWildcard - Whether a leading wildcard should be added.

setPattern

public void setPattern(
String patternString)
The pattern string for which this filter should select elements in the viewer.

Parameters:
patternString -

isElementSelectable

public boolean isElementSelectable(
Object element)
Answers whether the given element is a valid selection in the filtered tree. For example, if a tree has items that are categorized, the category itself may not be a valid selection since it is used merely to organize the elements.

Parameters:
element -
Returns:
true if this element is eligible for automatic selection

isElementVisible

public boolean isElementVisible(
Viewer viewer,
                                
Object element)
Answers whether the given element in the given viewer matches the filter pattern. This is a default implementation that will show a leaf element in the tree based on whether the provided filter text matches the text of the given element's text, or that of it's children (if the element has any). Subclasses may override this method.

Parameters:
viewer - the tree viewer in which the element resides
element - the element in the tree to check for a match
Returns:
true if the element matches the filter pattern

isParentMatch

protected boolean isParentMatch(
Viewer viewer,
                                
Object element)
Check if the parent (category) is a match to the filter text. The default behavior returns true if the element has at least one child element that is a match with the filter text. Subclasses may override this method.

Parameters:
viewer - the viewer that contains the element
element - the tree element to check
Returns:
true if the given element has children that matches the filter text

isLeafMatch

protected boolean isLeafMatch(
Viewer viewer,
                              
Object element)
Check if the current (leaf) element is a match with the filter text. The default behavior checks that the label of the element is a match. Subclasses should override this method.

Parameters:
viewer - the viewer that contains the element
element - the tree element to check
Returns:
true if the given element's label matches the filter text

wordMatches

protected boolean wordMatches(
String text)
Return whether or not if any of the words in text satisfy the match critera.

Parameters:
text - the text to match
Returns:
boolean true if one of the words in text satisifes the match criteria.

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire