KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > ui > search > JavaSearchPageScoreComputer


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.internal.ui.search;
12
13 import org.eclipse.search.ui.ISearchPageScoreComputer;
14
15 import org.eclipse.jdt.core.IJavaElement;
16
17 import org.eclipse.jdt.internal.ui.browsing.LogicalPackage;
18 import org.eclipse.jdt.internal.ui.javaeditor.IClassFileEditorInput;
19
20 public class JavaSearchPageScoreComputer implements ISearchPageScoreComputer {
21
22     public int computeScore(String JavaDoc id, Object JavaDoc element) {
23         if (!JavaSearchPage.EXTENSION_POINT_ID.equals(id))
24             // Can't decide
25
return ISearchPageScoreComputer.UNKNOWN;
26         
27         if (element instanceof IJavaElement || element instanceof IClassFileEditorInput || element instanceof LogicalPackage)
28             return 90;
29         
30         return ISearchPageScoreComputer.LOWEST;
31     }
32 }
33
Popular Tags