blob: 5ea5401f1aad191af5552ca83c1d779b144df66b (
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
|
/*******************************************************************************
* Copyright (c) 2000, 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.search.ui.text;
import org.eclipse.ui.IEditorPart;
/**
* This interface serves as an adapter between matches and editors. It is used to
* highlight matches in editors. Search implementors who want their matches highlighted
* must return an implementation of <code>IEditorMatchAdapter</code> from the <code>getEditorMatchAdapter()</code>
* method in their search result subclass.
* It is assumed that the match adapters are stateless, and no lifecycle management
* is provided.
* <p>
* Clients may implement this interface.
* </p>
* @see org.eclipse.search.ui.text.AbstractTextSearchResult
*
* @since 3.0
*/
public interface IEditorMatchAdapter {
/**
* Determines whether a match should be displayed in the given editor.
* For example, if a match is reported in a file, This method should return
* <code>true</code>, if the given editor displays the file.
*
* @param match The match.
* @param editor The editor that possibly contains the matches element.
* @return
*/
public abstract boolean isShownInEditor(Match match, IEditorPart editor);
/**
* Returns all matches that are contained in the element shown in the given
* editor.
* For example, if the editor shows a particular file, all matches in that file should
* be returned.
* @param result the result to search for matches
*
* @param editor The editor.
* @return All matches that are contained in the element that is shown in
* the given editor.
*/
public abstract Match[] computeContainedMatches(AbstractTextSearchResult result, IEditorPart editor);
}
|