Class StructureMergeViewerFilter
- 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 Summary
Fields Modifier and Type Field Description static com.google.common.base.Predicate<? super EObject>
DEFAULT_PREDICATE
A predicate use by default that always returns false.
-
Constructor Summary
Constructors Constructor Description StructureMergeViewerFilter(com.google.common.eventbus.EventBus eventBus)
Constructs the difference filter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFilter(IDifferenceFilter filter)
Add the predicate of the givenIDifferenceFilter
.Set<IDifferenceFilter>
getActiveDifferenceFilters()
Returns the set of activated filters known by this filter.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.Set<IDifferenceFilter>
getSelectedDifferenceFilters()
Returns the set of selected filters known by this filter.Set<IDifferenceFilter>
getUnSelectedDifferenceFilters()
Returns the set of unselected filters known by this viewer.void
init(Collection<IDifferenceFilter> selectedFilters, Collection<IDifferenceFilter> unselectedFilters, Collection<IDifferenceFilter> activeFilters)
Init this StructureMergeViewerFilter.void
removeFilter(IDifferenceFilter filter)
Remove the predicate of the givenIDifferenceFilter
.boolean
select(org.eclipse.jface.viewers.Viewer viewer, Object parentElement, Object element)
-
-
-
Field Detail
-
DEFAULT_PREDICATE
public static final com.google.common.base.Predicate<? super EObject> DEFAULT_PREDICATE
A predicate use by default that always returns false.
-
-
Method Detail
-
select
public boolean select(org.eclipse.jface.viewers.Viewer viewer, Object parentElement, Object element)
- Specified by:
select
in classorg.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 givenIDifferenceFilter
.- Parameters:
filter
- The givenIDifferenceFilter
.
-
removeFilter
public void removeFilter(IDifferenceFilter filter)
Remove the predicate of the givenIDifferenceFilter
.- Parameters:
filter
- The givenIDifferenceFilter
.
-
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.
-
-