Package org.eclipse.emf.compare.rcp.ui.structuremergeviewer.filters

# Class AbstractDifferenceFilter

java.lang.Object
org.eclipse.emf.compare.rcp.ui.structuremergeviewer.filters.AbstractDifferenceFilter

All Implemented Interfaces:
  `IDeactivableDiffFilter`, `IDifferenceFilter`

Direct Known Subclasses:
  `CascadingDifferencesFilter`, `TechnicalitiesFilter`

public abstract class AbstractDifferenceFilter extends Object implements IDeactivableDiffFilter
An abstract filter implementation.

Since:
  4.0

## Nested Class Summary

## Nested classes/interfaces inherited from interface org.eclipse.emf.compare.rcp.ui.structuremergeviewer.filters.IDifferenceFilter

`IDifferenceFilter.Registry`

## Field Summary

Fields
Modifier and Type
Field
Description
`protected boolean`
`activeByDefault`
The initial activation state of the filter.
`protected String`
`description`
`IDifferenceFilter.getDescription()`
`protected String`
`label`
A human-readable label for this filter.

## Constructor Summary

Constructors
Constructor
Description
`AbstractDifferenceFilter()`
Constructs the filter with the appropriate predicate.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`defaultSelected()`
Returns the initial activation state that the filter should have.
`String`
`getDescription()`
A human-readable description for this filter.
`String`
`getLabel()`
A human-readable label for this filter.
`abstract com.google.common.base.Predicate<? super EObject>`
`getPredicateWhenSelected()`
Returns the predicate that will filter out objects in the structural differences view when this filter will be selected.
`com.google.common.base.Predicate<? super EObject>`
`getPredicateWhenUnselected()`
Returns the predicate that will filter out objects in the structural differences view when this filter will be unselected.
`boolean`
`isActive()`
Whether the filter is enabled, i.e. will be taken into account in computations and displayed in the UI.
`boolean`
`isEnabled(IComparisonScope scope, Comparison comparison)`
Returns the activation condition based on the scope and comparison objects.
`void`
`setActive(boolean active)`
Set the activation of the filter.
`void`
`setDefaultSelected(boolean active)`
Set the initial activation state that the filter should have.
`void`
`setDescription(String description)`
Set the description for this filter.
`void`
`setLabel(String label)`
Set the label for this filter.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### label

protected String label
A human-readable label for this filter. This will be displayed in the EMF Compare UI.

### description

protected String description
`IDifferenceFilter.getDescription()`

### activeByDefault

protected boolean activeByDefault
The initial activation state of the filter.

## Constructor Details

### AbstractDifferenceFilter

public AbstractDifferenceFilter()
Constructs the filter with the appropriate predicate.

## Method Details

### getPredicateWhenSelected

public abstract com.google.common.base.Predicate<? super EObject> getPredicateWhenSelected()
Returns the predicate that will filter out objects in the structural differences view when this filter will be selected.

Specified by:
  `getPredicateWhenSelected` in interface `IDifferenceFilter`
Returns:
  the predicate that will filter out objects in the structural differences view when this filter will be selected.
See Also:
  - `IDifferenceFilter.getPredicateWhenSelected()`

### getPredicateWhenUnselected

public com.google.common.base.Predicate<? super EObject> getPredicateWhenUnselected()
Returns the predicate that will filter out objects in the structural differences view when this filter will be unselected.

Specified by:
  `getPredicateWhenUnselected` in interface `IDifferenceFilter`
Returns:
  the predicate that will filter out objects in the structural differences view when this filter will be unselected.
See Also:
  - `IDifferenceFilter.getPredicateWhenUnselected()`

### getLabel

public String getLabel()
A human-readable label for this filter. This will be displayed in the EMF Compare UI.

Specified by:
  `getLabel` in interface `IDifferenceFilter`
Returns:
  The label for this filter.
See Also:
  - `IDifferenceFilter.getLabel()`

### setLabel

public void setLabel(String label)
Set the label for this filter. This will be displayed in the EMF Compare UI.

Specified by:
  `setLabel` in interface `IDifferenceFilter`
Parameters:
  `label` - A human-readable label for this filter.
See Also:
  - `IDifferenceFilter.setLabel(java.lang.String)`

### getDescription

public String getDescription()
A human-readable description for this filter. This will be displayed in the EMF Compare UI.

Specified by:
  `getDescription` in interface `IDifferenceFilter`
Returns:
  Description or `null`

### setDescription

public void setDescription(String description)
Set the description for this filter. This will be displayed in the EMF Compare UI.

Specified by:
  `setDescription` in interface `IDifferenceFilter`
Parameters:
  `description` - A human-readable description for this filter.

### defaultSelected

public boolean defaultSelected()
Returns the initial activation state that the filter should have.

Specified by:
  `defaultSelected` in interface `IDifferenceFilter`
Returns:
  The initial activation state that the filter should have.
See Also:
  - `IDifferenceFilter.defaultSelected()`

### isActive

public boolean isActive()
Whether the filter is enabled, i.e. will be taken into account in computations and displayed in the UI.

Specified by:
  `isActive` in interface `IDeactivableDiffFilter`
Returns:
  The enablement of the filter.
Since:
  4.3
See Also:
  - `IDeactivableDiffFilter.isActive()`

### setDefaultSelected

public void setDefaultSelected(boolean active)
Set the initial activation state that the filter should have.

Specified by:
  `setDefaultSelected` in interface `IDifferenceFilter`
Parameters:
  `active` - The initial activation state that the filter should have (true if the filter should be active by default).
See Also:
  - `IDifferenceFilter.setDefaultSelected(boolean)`

### setActive

public void setActive(boolean active)
Description copied from interface: `IDeactivableDiffFilter`
Set the activation of the filter.

Specified by:
  `setActive` in interface `IDeactivableDiffFilter`
Parameters:
  `active` - Whether the filter should be active
Since:
  4.3

### isEnabled

public boolean isEnabled(IComparisonScope scope, Comparison comparison)
Returns the activation condition based on the scope and comparison objects.

Specified by:
  `isEnabled` in interface `IDifferenceFilter`
Parameters:
  `scope` - The scope on which the filter will be applied.
  `comparison` - The comparison which is to be displayed in the structural view.
Returns:
  The activation condition based on the scope and comparison objects.
See Also:
  - `IDifferenceFilter.isEnabled(org.eclipse.emf.compare.scope.IComparisonScope, org.eclipse.emf.compare.Comparison)`