java.lang.Object
org.eclipse.jface.viewers.ViewerFilter
org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.StructureMergeViewerFilter

public class StructureMergeViewerFilter extends org.eclipse.jface.viewers.ViewerFilter
This will be used by the structure viewer to filter out its list of differences according to a number of provided predicates.

Note that this filter acts as an "OR" predicate between all provided ones, and that filters are "exclude" filters. Basically, that means if the user selects two filters, any difference that applies for any of these two filters will be hidden from the view, contrarily to "classic" ViewerFilter that act as "AND" predicates for "include" filters, forcing any displayed element to meet the criterion of all provided filters.

Since:
4.0
  • Field Details

    • DEFAULT_PREDICATE

      public static final com.google.common.base.Predicate<? super EObject> DEFAULT_PREDICATE
      A predicate use by default that always returns false.
  • Constructor Details

    • StructureMergeViewerFilter

      public StructureMergeViewerFilter(com.google.common.eventbus.EventBus eventBus)
      Constructs the difference filter.
      Parameters:
      eventBus - The EventBus which will be associated with this filter.
  • Method Details

    • select

      public boolean select(org.eclipse.jface.viewers.Viewer viewer, Object parentElement, Object element)
      Specified by:
      select in class org.eclipse.jface.viewers.ViewerFilter
      See Also:
      • ViewerFilter.select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
    • addFilter

      public void addFilter(IDifferenceFilter filter)
      Add the predicate of the given IDifferenceFilter.
      Parameters:
      filter - The given IDifferenceFilter.
    • removeFilter

      public void removeFilter(IDifferenceFilter filter)
      Remove the predicate of the given IDifferenceFilter.
      Parameters:
      filter - The given IDifferenceFilter.
    • init

      public void init(Collection<IDifferenceFilter> selectedFilters, Collection<IDifferenceFilter> unselectedFilters, Collection<IDifferenceFilter> activeFilters)
      Init this StructureMergeViewerFilter.
      Parameters:
      selectedFilters - the set of selected filters known by this filter.
      unselectedFilters - the set of unselected filters known by this filter.
      activeFilters - the set of activated filters known by this filter.
    • getSelectedDifferenceFilters

      public Set<IDifferenceFilter> getSelectedDifferenceFilters()
      Returns the set of selected filters known by this filter.
      Returns:
      the selectedDifferenceFilters the set of selected filters known by this filter.
    • getActiveDifferenceFilters

      public Set<IDifferenceFilter> getActiveDifferenceFilters()
      Returns the set of activated filters known by this filter.
      Returns:
      the activatedDifferenceFilters the set of activated filters known by this filter.
    • getUnSelectedDifferenceFilters

      public Set<IDifferenceFilter> getUnSelectedDifferenceFilters()
      Returns the set of unselected filters known by this viewer.
      Returns:
      the unselectedDifferenceFilters the set of unselected filters known by this viewer.
    • getAggregatedPredicate

      public com.google.common.base.Predicate<? super EObject> getAggregatedPredicate()
      Returns the predicate that aggregates the selected state predicates of selected filters and the unselected state predicates of unselected filters.
      Returns:
      the predicate that aggregates the selected state predicates of selected filters and the unselected state predicates of unselected filters.