crashanalysis/crashanalyser/com.nokia.s60tools.crashanalyser/src/com/nokia/s60tools/crashanalyser/search/TextViewerFilter.java
equal
deleted
inserted
replaced
|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 package com.nokia.s60tools.crashanalyser.search; |
|
19 |
|
20 import org.eclipse.jface.viewers.Viewer; |
|
21 import org.eclipse.jface.viewers.ViewerFilter; |
|
22 |
|
23 /** |
|
24 * A filter class for a text viewer. Used e.g. in ErrorLibrary dialog to |
|
25 * filter list of text which match to what user has started to write. |
|
26 * |
|
27 */ |
|
28 public class TextViewerFilter extends ViewerFilter { |
|
29 |
|
30 String filterText = ""; |
|
31 |
|
32 /** |
|
33 * Constructor |
|
34 * @param text text to match |
|
35 */ |
|
36 public TextViewerFilter(String text) { |
|
37 filterText = text.toLowerCase(); |
|
38 } |
|
39 |
|
40 @Override |
|
41 public boolean select(Viewer viewer, Object parentElement, Object element) { |
|
42 if (element.toString().toLowerCase().startsWith(filterText)) |
|
43 return true; |
|
44 return false; |
|
45 } |
|
46 |
|
47 public boolean isFilterProperty(Object element, String property) { |
|
48 return true; |
|
49 } |
|
50 |
|
51 } |