01: /*******************************************************************************
02: * Copyright (c) 2000, 2005 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jdt.ui.search;
11:
12: import org.eclipse.jface.viewers.ILabelProvider;
13: import org.eclipse.search.ui.text.Match;
14: import org.eclipse.ui.PartInitException;
15:
16: /**
17: * This interface serves to display elements that a search participant has contributed to a search
18: * result.
19: * <p>
20: * Each {@link IMatchPresentation} is associated with a particular {@link IQueryParticipant}. The {@link IMatchPresentation}
21: * will only be asked to handle elements and matches which its {@link IQueryParticipant} contributed to the
22: * search result. If two search participants report matches against the same element, one of them will
23: * be chosen to handle the element.
24: * </p>
25: * <p>
26: * Clients may implement this interface.
27: * </p>
28: * @since 3.0
29: */
30: public interface IMatchPresentation {
31: /**
32: * Creates a new instance of a label provider for elements that have been contributed
33: * to a search result by the corresponding query participant. The search view
34: * will call this method when it needs to render elements and will dispose the
35: * label providers when it is done with them. This method may therefore be called
36: * multiple times.
37: * @return A label provider for elements found by the corresponding query participant.
38: */
39: ILabelProvider createLabelProvider();
40:
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,
62: boolean activate) throws PartInitException;
63: }
|