KickJava   Java API By Example, From Geeks To Geeks.

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


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
13 import org.eclipse.ui.IEditorPart;
14
15 /**
16  * This interface serves as an adapter between matches and editors. It is used to
17  * highlight matches in editors. Search implementors who want their matches highlighted
18  * must return an implementation of <code>IEditorMatchAdapter</code> from the <code>getEditorMatchAdapter()</code>
19  * method in their search result subclass.
20  * It is assumed that the match adapters are stateless, and no lifecycle management
21  * is provided.
22  * <p>
23  * Clients may implement this interface.
24  * </p>
25  * @see org.eclipse.search.ui.text.AbstractTextSearchResult
26  *
27  * @since 3.0
28  */

29 public interface IEditorMatchAdapter {
30     /**
31      * Determines whether a match should be displayed in the given editor.
32      * For example, if a match is reported in a file, This method should return
33      * <code>true</code>, if the given editor displays the file.
34      *
35      * @param match The match
36      * @param editor The editor that possibly contains the matches element
37      * @return whether the given match should be displayed in the editor
38      */

39     public abstract boolean isShownInEditor(Match match, IEditorPart editor);
40     /**
41      * Returns all matches that are contained in the element shown in the given
42      * editor.
43      * For example, if the editor shows a particular file, all matches in that file should
44      * be returned.
45      * @param result the result to search for matches
46      *
47      * @param editor The editor.
48      * @return All matches that are contained in the element that is shown in
49      * the given editor.
50      */

51     public abstract Match[] computeContainedMatches(AbstractTextSearchResult result, IEditorPart editor);
52     
53 }
54
Popular Tags