KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > search > DependencyExtentViewerSorter


1 /*******************************************************************************
2  * Copyright (c) 2000, 2003 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.pde.internal.ui.search;
12
13 import org.eclipse.jdt.core.IType;
14 import org.eclipse.jdt.core.JavaModelException;
15 import org.eclipse.jface.viewers.ViewerSorter;
16 import org.eclipse.search.ui.ISearchResultViewEntry;
17
18 /**
19  * Insert the type's description here.
20  * @see ViewerSorter
21  */

22 public class DependencyExtentViewerSorter extends ViewerSorter {
23     /**
24      * The constructor.
25      */

26     public DependencyExtentViewerSorter() {
27     }
28
29     public int category(Object JavaDoc element) {
30         try {
31             if (element instanceof ISearchResultViewEntry) {
32                 Object JavaDoc object = ((ISearchResultViewEntry)element).getGroupByKey();
33                 if (object instanceof IType) {
34                     if (((IType)object).isClass())
35                         return 1;
36                     return 0;
37                 }
38             }
39         } catch (JavaModelException e) {
40         }
41         return 2;
42     }
43
44
45 }
46
Popular Tags