Skip to main content
summaryrefslogtreecommitdiffstats
blob: 1d740d35476e752654136f8f2a34fbaa9b1fbfb0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
package org.eclipse.compare;

import java.util.HashMap;

import org.eclipse.jface.text.IRegion;

/*******************************************************************************
 * Copyright (c) 2013 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

/**
 * A filter that can be applied during the comparison of documents that can be
 * used to customize the detection of text differences via the compareFilter
 * extension point. Filters are exposed as toggle actions in the compare viewer.
 * 
 * @noimplement This interface is not intended to be implemented by clients.
 *              This is an interface for org.eclipse.compare.compareFilters
 *              extension point which is internal.
 * @since 3.6
 */
public interface ICompareFilter {

	/**
	 * Key for the <code>String</code> of the line of text being compared.
	 */
	public static final String THIS_LINE = "THIS_LINE"; //$NON-NLS-1$

	/**
	 * Key for the <code>Character</code> representing contributor of this line.
	 * Value is either 'A' for ancestor, 'L' for left, or 'R' for right.
	 */
	public static final String THIS_CONTRIBUTOR = "THIS_CONTRIBUTOR"; //$NON-NLS-1$

	/**
	 * Key for the <code>String</code> of the line of text this line is being
	 * compared to.
	 */
	public static final String OTHER_LINE = "OTHER_LINE"; //$NON-NLS-1$

	/**
	 * Key for the <code>Character</code> representing contributor of the other
	 * line. Value is either 'A' for ancestor, 'L' for left, or 'R' for right.
	 */
	public static final String OTHER_CONTRIBUTOR = "OTHER_CONTRIBUTOR"; //$NON-NLS-1$

	/**
	 * Forwards the current input objects of the compare
	 * 
	 * @param input
	 *            the merge viewer input
	 * @param ancestor
	 *            input into ancestor viewer
	 * @param left
	 *            input into left viewer
	 * @param right
	 *            input into right viewer
	 */
	public void setInput(Object input, Object ancestor, Object left,
			Object right);

	/**
	 * Identifies the regions of a line of text in a comparison that should be
	 * ignored for comparison purposes.
	 * 
	 * @param lineComparison
	 *            contains values for the keys <CODE>THIS_LINE</CODE>,
	 *            <CODE>THIS_CONTRIBUTOR</CODE>, <CODE>OTHER_LINE</CODE> and
	 *            <CODE>OTHER_CONTRIBUTOR</CODE>
	 * @return Regions of <code>THIS_LINE</code> to be ignored for comparison
	 *         purposes.
	 */
	public IRegion[] getFilteredRegions(HashMap lineComparison);

	/**
	 * Returns whether the filter should be enabled when first initialized
	 * 
	 * @return default enablement
	 */
	public boolean isEnabledInitially();

	/**
	 * Because the comparison routine may compare each line multiple times to
	 * other lines, the ignored regions may need to be calculated multiple times
	 * for the same line during a comparison. If the ignored regions for each
	 * line will be the same regardless of what line it is being compared to,
	 * returning <code>true</code> to this method will cause the ignored region
	 * calculations to be re-used and improve the performance of the comparison.
	 * 
	 * @return ignored region results can be cached
	 */
	public boolean canCacheFilteredRegions();
}

Back to the top