# Compare Filters

This extension point is internal

###### Identifier:

org.eclipse.compare.compareFilters

###### Since:

[Enter the first release in which this extension point appears.]

###### Description:

This extension point is for internal use only.
This extension point allows a plug-in to register a compare filter for specific content types. The filter will be exposed as a toggle action in the compare viewer and can be used to customize how differences are calculated when comparing documents as well as affect the calculation of structural differences. The extension point must implement the interface `org.eclipse.compare.ICompareFilter`. For the filter to affect the calculation of structural differences, the structure creator must extend `org.eclipse.compare.structuremergeviewer.StructureCreator`.

###### Configuration Markup:

<!ELEMENT extension (filter* , contentTypeBinding*)>

<!ATTLIST extension

point CDATA #REQUIRED

id CDATA #IMPLIED

name CDATA #IMPLIED>

Internal use only

- point - a fully qualified identifier of the target extension point
- id - an optional identifier of the extension instance
- name - an optional name of the extension instance

<!ELEMENT filter EMPTY>

<!ATTLIST filter

id CDATA #REQUIRED

definitionId IDREF #IMPLIED

extensions CDATA #IMPLIED

class CDATA #REQUIRED

filter.label CDATA #REQUIRED

filter.tooltip CDATA #REQUIRED

filter.tooltip.checked CDATA #IMPLIED

filter.tooltip.unchecked CDATA #IMPLIED

filter.description CDATA #REQUIRED

filter.description.checked CDATA #IMPLIED

filter.description.unchecked CDATA #IMPLIED

filter.image CDATA #IMPLIED>

Internal use only

- id - A unique identifier that can be used to reference the filter. It will also be used as the action id for the toggle action added to the compare viewer
- definitionId - The command id of the toggle action added to the compare viewer
- extensions - a comma separated list of file extensions e.g. "java, txt"
- class - Implementation of ICompareFilter.
- filter.label - A translatable label that will be used in the UI for this filter.
- filter.tooltip - A translatable label that will be used in the UI for this filter.
- filter.tooltip.checked - A translatable label that will be used in the UI for this filter.
- filter.tooltip.unchecked - A translatable label that will be used in the UI for this filter.
- filter.description - A translatable label that will be used in the UI for this filter.
- filter.description.checked - A translatable label that will be used in the UI for this filter.
- filter.description.unchecked - A translatable label that will be used in the UI for this filter.
- filter.image - An image that will be used in the UI for this filter.

<!ELEMENT contentTypeBinding EMPTY>

<!ATTLIST contentTypeBinding

contentTypeId IDREF #REQUIRED

filterId IDREF #REQUIRED>

Internal use only.
A `contentTypeBinding` binds a compare filter to a content type.

- contentTypeId - The id of a content type defined using the `org.eclipse.core.contenttype.contentTypes` extension point.
- filterId - The id of a filter defined using the `filter` element of this extension point (i.e. `org.eclipse.compare.compareFilters`)

###### Examples:

The following is an example of a compare filter for example files (extensions ".example" and ".example2") and the text content type:

    <extension
             point="org.eclipse.compare.compareFilters">
          <filter
               id="com.example.IgnorePrefixId"
                class="com.example.IgnorePrefix"
                extensions="example,example2"
                definitionId="com.example.IgnorePrefixCommand"
                filter.description="Ignore Columns 1-6"
                filter.label="Ignore Prefix"
                filter.image="/icons/ignorePrefix.gif"
                filter.tooltip="Ignore Prefix">
          </filter>
          <contentTypeBinding
      contentTypeId="org.eclipse.core.runtime.text"
      filterId="com.example.IgnorePrefixId">
       </contentTypeBinding>
       </extension>

###### API Information:

The contributed class must implement `org.eclipse.compare.ICompareFilter`. For the filter to affect the calculation of structural differences, the structure creator must extend `org.eclipse.compare.structuremergeviewer.StructureCreator`.

###### Supplied Implementation:

[Enter information about supplied implementation of this extension point.]

Copyright (c) 2013 IBM Corporation and others.
This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at https://www.eclipse.org/legal/epl-v20.html/ SPDX-License-Identifier: EPL-2.0