KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > search > ui > text > IFileMatchAdapter


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.search.ui.text;
12 import org.eclipse.core.resources.IFile;
13 /**
14  * This interface serves to map matches to <code>IFile</code> instances. Changes to those
15  * files are then tracked (via the platforms file buffer mechanism) and matches
16  * updated when changes are saved. Clients who want their match positions
17  * automatically updated should return an implementation of
18  * <code>IFileMatchAdapter</code> from the <code>getFileMatchAdapter()</code>
19  * method in their search result implementation. It is assumed that the match
20  * adapters are stateless, and no lifecycle management is provided.
21  * <p>
22  * Clients may implement this interface.
23  * </p>
24  * @see org.eclipse.search.ui.text.AbstractTextSearchResult
25  *
26  * @since 3.0
27  */

28 public interface IFileMatchAdapter {
29     /**
30      * Returns an array with all matches contained in the given file in the
31      * given search result. If the matches are not contained within an
32      * <code>IFile</code>, this method must return an empty array.
33      *
34      * @param result the search result to find matches in
35      * @param file the file to find matches in
36      *
37      * @return an array of matches (possibly empty)
38      */

39     public abstract Match[] computeContainedMatches(AbstractTextSearchResult result, IFile file);
40     /**
41      * Returns the file associated with the given element (usually the file the
42      * element is contained in). If the element is not associated with a file,
43      * this method should return <code>null</code>.
44      *
45      * @param element an element associated with a match
46      *
47      * @return the file associated with the element or <code>null</code>
48      */

49     public abstract IFile getFile(Object JavaDoc element);
50 }
51
Popular Tags