Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.jface.viewers
Class ViewerFilter

    java.lang.Object
      org.eclipse.jface.viewers.ViewerFilter

Direct Known Subclasses:
  ResourcePatternFilter, ResourceWorkingSetFilter

public abstract class ViewerFilter
extends Object

A viewer filter is used by a structured viewer to extract a subset of elements provided by its content provider.

Subclasses must implement the `select` method and may implement the `isFilterProperty` method.

See Also:
  `IStructuredContentProvider`, `StructuredViewer`

Constructor Summary
`protected` | `ViewerFilter()` Creates a new viewer filter.

Method Summary
`Object[]` | `filter(Viewer viewer, Object parent, Object[] elements)` Filters the given elements for the given viewer.
`boolean` | `isFilterProperty(Object element, String property)` Returns whether this viewer filter would be affected by a change to the given property of the given element.
`abstract boolean` | `select(Viewer viewer, Object parentElement, Object element)` Returns whether the given element makes it through this filter.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ViewerFilter

    protected ViewerFilter()

  Creates a new viewer filter.

Method Detail

### filter

    public Object[] filter(Viewer viewer,
                           Object parent,
                           Object[] elements)

  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`.

  Parameters:
    `viewer` - the viewer
    `parent` - the parent element
    `elements` - the elements to filter
  Returns:
    the filtered elements

### isFilterProperty

    public boolean isFilterProperty(Object element,
                                    String property)

  Returns whether this viewer filter would be affected by a change to the given property of the given element.

  The default implementation of this method returns `false`. Subclasses should reimplement.

  Parameters:
    `element` - the element
    `property` - the property
  Returns:
    `true` if the filtering would be affected, and `false` if it would be unaffected

### select

    public abstract boolean select(Viewer viewer,
                                   Object parentElement,
                                   Object element)

  Returns whether the given element makes it through this filter.

  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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.