Package org.eclipse.ui.views.markers.internal

# Class MarkerFilter

java.lang.Object
org.eclipse.ui.views.markers.internal.MarkerFilter

All Implemented Interfaces:
  `Cloneable`

Direct Known Subclasses:
  `ProblemFilter`

public class MarkerFilter extends Object implements Cloneable
MarkerFilter is the class that defines a filter on markers in a MarkerView.

## Field Summary

Fields
Modifier and Type
Field
Description
`protected boolean`
`enabled`
`static final int`
`ON_ANY`
Constant for any element.
`static final int`
`ON_ANY_IN_SAME_CONTAINER`
Constant for any element in same container.
`static final int`
`ON_SELECTED_AND_CHILDREN`
Constant for selected element and children.
`static final int`
`ON_SELECTED_ONLY`
Constant for any selected element only.
`static final int`
`ON_WORKING_SET`
Constant for on working set.
`protected int`
`onResource`
`protected List<MarkerType>`
`rootTypes`
`static final String`
`SELECTED_FALSE`
Attribute status true.
`protected List<MarkerType>`
`selectedTypes`
`static final String`
`TAG_ON_RESOURCE`
The tag for the scope.
`static final String`
`TAG_SELECTION_STATUS`
New attribute to handle the selection status of marker types.
`protected IWorkingSet`
`workingSet`

## Method Summary

Modifier and Type
Method
Description
`void`
`addAllSubTypes(List<MarkerType> types)`
List all types known to this MarkerFilter.
`MarkerType`
`getMarkerType(String id)`
Find the typeModel entry that matches id.
`String`
`getName()`
Get the name of the receiver
`int`
`getOnResource()`
`MarkerFilter.ON_ANY` if showing items associated with any resource. `MarkerFilter.ON_SELECTED_ONLY` if showing items associated with the selected resource within the workbench. `MarkerFilter.ON_SELECTED_AND_CHILDREN` if showing items associated with the selected resource within the workbench and its children. `MarkerFilter.ON_ANY_OF_SAME_PROJECT` if showing items in the same project as the selected resource within the workbench. `MarkerFilter.ON_WORKING_SET` if showing items in some working set.
`List<MarkerType>`
`getRootTypes()`
Warning: for internal package use only.
`List<MarkerType>`
`getSelectedTypes()`
Warning: for internal package use only.
`boolean`
`isEnabled()`
`MarkerFilter`
`makeClone()`
Make a clone of the receiver.
`void`
`restoreFilterSettings(IDialogSettings settings)`
Restore the state of the receiver in the supplied settings.
`protected void`
`restoreFilterSettings(IMemento memento)`
Restore the state of the receiver in the supplied settings.
`final void`
`restoreState(IMemento memento)`
Restore the state in the memento.
`void`
`saveFilterSettings(IMemento settings)`
Save the filter settings for the receiver.
`boolean`
`select(ConcreteMarker marker)`
Return whether or not the receiver would select the marker.
`protected boolean`
`selectMarker(ConcreteMarker marker)`
Subclasses should override to determine if the given marker passes the filter.
`void`
`setFocusResource(IResource[] resources)`
Sets the focused resources.
`void`
`setSelectedTypes(List<MarkerType> selectedTypes)`
Set the selected types.

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

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

## Field Details

### TAG_ON_RESOURCE

public static final String TAG_ON_RESOURCE
The tag for the scope.

See Also:
  - Constant Field Values

### TAG_SELECTION_STATUS

public static final String TAG_SELECTION_STATUS
New attribute to handle the selection status of marker types.

See Also:
  - Constant Field Values

### SELECTED_FALSE

public static final String SELECTED_FALSE
Attribute status true.

See Also:
  - Constant Field Values

### ON_ANY

public static final int ON_ANY
Constant for any element.

See Also:
  - Constant Field Values

### ON_SELECTED_ONLY

public static final int ON_SELECTED_ONLY
Constant for any selected element only.

See Also:
  - Constant Field Values

### ON_SELECTED_AND_CHILDREN

public static final int ON_SELECTED_AND_CHILDREN
Constant for selected element and children.

See Also:
  - Constant Field Values

### ON_ANY_IN_SAME_CONTAINER

public static final int ON_ANY_IN_SAME_CONTAINER
Constant for any element in same container.

See Also:
  - Constant Field Values

### ON_WORKING_SET

public static final int ON_WORKING_SET
Constant for on working set.

See Also:
  - Constant Field Values

### rootTypes

protected List<MarkerType> rootTypes

### selectedTypes

protected List<MarkerType> selectedTypes

### workingSet

protected IWorkingSet workingSet

### onResource

protected int onResource

### enabled

protected boolean enabled

## Method Details

### addAllSubTypes

public void addAllSubTypes(List<MarkerType> types)
List all types known to this MarkerFilter.

Parameters:
  `types` - list to be filled in with types

### selectMarker

protected boolean selectMarker(ConcreteMarker marker)
Subclasses should override to determine if the given marker passes the filter.

Parameters:
  `marker` - unused, but can be used in overrides
Returns:
  `true` if the marker passes the filter and `false` otherwise

### select

public boolean select(ConcreteMarker marker)
Return whether or not the receiver would select the marker.

Returns:
  boolean

### getOnResource

public int getOnResource()

- `MarkerFilter.ON_ANY` if showing items associated with any resource.
- `MarkerFilter.ON_SELECTED_ONLY` if showing items associated with the selected resource within the workbench.
- `MarkerFilter.ON_SELECTED_AND_CHILDREN` if showing items associated with the selected resource within the workbench and its children.
- `MarkerFilter.ON_ANY_OF_SAME_PROJECT` if showing items in the same project as the selected resource within the workbench.
- `MarkerFilter.ON_WORKING_SET` if showing items in some working set.

Returns:
  int

### setFocusResource

public void setFocusResource(IResource[] resources)
Sets the focused resources.

### isEnabled

public boolean isEnabled()

Returns:
  - `true` if the filter is enabled.
  - `false` if the filter is not enabled.

### getRootTypes

public List<MarkerType> getRootTypes()
Warning: for internal package use only. Return the root marker types.

Returns:
  the root marker types.

### getSelectedTypes

public List<MarkerType> getSelectedTypes()
Warning: for internal package use only. Return the selected types.

Returns:
  the selected marker types to be displayed.

### getMarkerType

public MarkerType getMarkerType(String id)
Find the typeModel entry that matches id.

Parameters:
  `id` - the ID for a marker type
Returns:
  MarkerType or `null` if it is not found.

### restoreState

public final void restoreState(IMemento memento)
Restore the state in the memento.

### restoreFilterSettings

public void restoreFilterSettings(IDialogSettings settings)
Restore the state of the receiver in the supplied settings. This is kept for backwards compatibility with 3.1 dialog settings.

### restoreFilterSettings

protected void restoreFilterSettings(IMemento memento)
Restore the state of the receiver in the supplied settings.

### saveFilterSettings

public void saveFilterSettings(IMemento settings)
Save the filter settings for the receiver.

### getName

public String getName()
Get the name of the receiver

Returns:
  String

### makeClone

public MarkerFilter makeClone() throws CloneNotSupportedException
Make a clone of the receiver.

Returns:
  MarkerFilter
Throws:
  `CloneNotSupportedException`

### setSelectedTypes

public void setSelectedTypes(List<MarkerType> selectedTypes)
Set the selected types.

Parameters:
  `selectedTypes` - List of MarkerType.