KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > ui > search > IMatchPresentation


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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.jdt.ui.search;
12
13 import org.eclipse.jface.viewers.ILabelProvider;
14 import org.eclipse.search.ui.text.Match;
15 import org.eclipse.ui.PartInitException;
16
17 /**
18  * This interface serves to display elements that a search participant has contributed to a search
19  * result.
20  * <p>
21  * Each {@link IMatchPresentation} is associated with a particular {@link IQueryParticipant}. The {@link IMatchPresentation}
22  * will only be asked to handle elements and matches which its {@link IQueryParticipant} contributed to the
23  * search result. If two search participants report matches against the same element, one of them will
24  * be chosen to handle the element.
25  * </p>
26  * <p>
27  * Clients may implement this interface.
28  * </p>
29  * @since 3.0
30  */

31 public interface IMatchPresentation {
32     /**
33      * Creates a new instance of a label provider for elements that have been contributed
34      * to a search result by the corresponding query participant. The search view
35      * will call this method when it needs to render elements and will dispose the
36      * label providers when it is done with them. This method may therefore be called
37      * multiple times.
38      * @return A label provider for elements found by the corresponding query participant.
39      */

40     ILabelProvider createLabelProvider();
41     /**
42      * Opens an editor on the given element and selects the given range of text.
43      * The location of matches are automatically updated when a file is edited
44      * through the file buffer infrastructure (see {@link org.eclipse.core.filebuffers.ITextFileBufferManager}).
45      * When a file buffer is saved, the current positions are written back to the
46      * match.
47      * If the <code>activate</code> parameter is <code>true</code> the opened editor
48      * should have be activated. Otherwise the focus should not be changed.
49      *
50      * @param match
51      * The match to show.
52      * @param currentOffset
53      * The current start offset of the match.
54      * @param currentLength
55      * The current length of the selection.
56      * @param activate
57      * Whether to activate the editor the match is shown in.
58      * @throws PartInitException
59      * If an editor can't be opened.
60      */

61     void showMatch(Match match, int currentOffset, int currentLength, boolean activate) throws PartInitException;
62 }
63
Popular Tags