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.search.ui; 12 13 import org.eclipse.jface.resource.ImageDescriptor; 14 15 /** 16 * Implementors of this interface represent the result of a search. How the 17 * results of a search are structured is up to the implementor of this 18 * interface. The abstract base implementation provided with 19 * {@link org.eclipse.search.ui.text.AbstractTextSearchResult AbstractTextSearchResult} 20 * uses a flat list of matches to represent the result of a search. Subclasses 21 * of <code>SearchResultEvent</code> can be used in order to notify listeners 22 * of search result changes. 23 * <p> 24 * To present search results to the user implementors of this interface must 25 * also provide an extension for the extension point 26 * <code>org.eclipse.search.searchResultViewPage</code>. 27 * </p> 28 * <p> 29 * Clients may implement this interface. 30 * </p> 31 * 32 * @see org.eclipse.search.ui.ISearchResultPage 33 * @since 3.0 34 */ 35 public interface ISearchResult { 36 /** 37 * Adds a <code>ISearchResultListener</code>. Has no effect when the 38 * listener has already been added. 39 * 40 * @param l the listener to be added 41 */ 42 void addListener(ISearchResultListener l); 43 /** 44 * Removes a <code>ISearchResultChangedListener</code>. Has no effect 45 * when the listener hasn't previously been added. 46 * 47 * @param l the listener to be removed 48 */ 49 void removeListener(ISearchResultListener l); 50 /** 51 * Returns a user readable label for this search result. The label is typically used in the result 52 * view and should contain the search query string and number of matches. 53 * 54 * @return the label for this search result 55 */ 56 String getLabel(); 57 /** 58 * Returns a tooltip to be used when this search result is shown in the UI. 59 * 60 * @return a user readable String 61 */ 62 String getTooltip(); 63 /** 64 * Returns an image descriptor for the given ISearchResult. 65 * 66 * @return an image representing this search result or <code>null</code> 67 */ 68 ImageDescriptor getImageDescriptor(); 69 /** 70 * Returns the query that produced this search result. 71 * 72 * @return the query producing this result 73 */ 74 ISearchQuery getQuery(); 75 } 76