Skip to main content
summaryrefslogtreecommitdiffstats
blob: 3b9daafd9e3cae0c5de803001a02c0655260f725 (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
/*******************************************************************************
 * 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.core.resources.IFile;
/**
 * This interface serves to map matches to <code>IFile</code> instances. Changes to those
 * files are then tracked (via the platforms file buffer mechanism) and matches
 * updated when changes are saved. Clients who want their match positions
 * automatically updated should return an implementation of
 * <code>IFileMatchAdapter</code> from the <code>getFileMatchAdapter()</code>
 * method in their search result implementation. 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 IFileMatchAdapter {
	/**
	 * Returns an array with all matches contained in the given file in the
	 * given search result. If the matches are not contained within an
	 * <code>IFile</code>, this method must return an empty array.
	 * 
	 * @param result the search result to find matches in
	 * @param file the file to find matches in
	 * 
	 * @return an array of matches (possibly empty)
	 */
	public abstract Match[] computeContainedMatches(AbstractTextSearchResult result, IFile file);
	/**
	 * Returns the file associated with the given element (usually the file the
	 * element is contained in). If the element is not associated with a file,
	 * this method should return <code>null</code>.
	 * 
	 * @param element an element associated with a match
	 * 
	 * @return the file associated with the element or <code>null</code>
	 */
	public abstract IFile getFile(Object element);
}

Back to the top