KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > search > ui > ISearchPageScoreComputer


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 /**
14  * Computes a score that is used by the search dialog
15  * to find the best fitting page for a selection when opened.
16  * The score has no upper limit but must be at least
17  * <code>LOWEST</code>. Higher values means the page is better
18  * suited for the given selection input.
19  * <p>
20  * For example, a Java-specific search page score computer could test
21  * if the page is a Java search page and returns high scores
22  * for Java elements as selection input.
23  *
24  * Intended to be implemented.
25  * </p>
26  */

27 public interface ISearchPageScoreComputer {
28
29     /**
30      * Invalid score value indicating a score is unknown or undecided.
31      */

32     public static final int UNKNOWN= -1;
33
34     /**
35      * Lowest possible valid score.
36      */

37     public static final int LOWEST= 0;
38
39     /**
40      * Computes and returns a score indicating how good the page with the given
41      * id can handle the given input element.
42      * The search page id appears as the <code>id</code> attribute of the
43      * <code>&lt;page&gt;</code> element contributed to the
44      * search pages extension point (<code>"org.eclipse.search.searchPages"</code>).
45      *
46      * @param pageId the string id of the page for which the score is computed
47      * @param input the object based on which the page should open
48      * @return a score higher or equal to <code>LOWEST</code>, or
49      * <code>UNKNOWN</code> if this computer cannot decide
50      */

51     public int computeScore(String JavaDoc pageId, Object JavaDoc input);
52 }
53
Popular Tags