sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi/src/com/nokia/carbide/cpp/internal/pi/utils/PIFileFilter.java
equal
deleted
inserted
replaced
|
1 /* |
|
2 * Copyright (c) 2009 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 the License "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 /* |
|
19 * PIFileFilter.java |
|
20 */ |
|
21 package com.nokia.carbide.cpp.internal.pi.utils; |
|
22 |
|
23 import java.io.File; |
|
24 |
|
25 import javax.swing.filechooser.FileFilter; |
|
26 |
|
27 public class PIFileFilter extends FileFilter |
|
28 { |
|
29 String myFilter; |
|
30 public PIFileFilter(String filter) |
|
31 { |
|
32 this.myFilter = filter; |
|
33 } |
|
34 |
|
35 public boolean accept(File f) |
|
36 { |
|
37 if (f.isDirectory()) |
|
38 return true; |
|
39 |
|
40 if (f.getName().endsWith(myFilter)) |
|
41 return true; |
|
42 else |
|
43 return false; |
|
44 } |
|
45 |
|
46 public String getDescription() |
|
47 { |
|
48 if (this.myFilter.equals(Messages.getString("PIFileFilter.bapFilter"))) //$NON-NLS-1$ |
|
49 { |
|
50 return Messages.getString("PIFileFilter.bapDescription"); //$NON-NLS-1$ |
|
51 } |
|
52 else if (this.myFilter.equals(Messages.getString("PIFileFilter.datFilter"))) //$NON-NLS-1$ |
|
53 { |
|
54 return Messages.getString("PIFileFilter.datDescription"); //$NON-NLS-1$ |
|
55 } |
|
56 else if (this.myFilter.equals(Messages.getString("PIFileFilter.csvFilter"))) //$NON-NLS-1$ |
|
57 { |
|
58 return Messages.getString("PIFileFilter.csvDescription"); //$NON-NLS-1$ |
|
59 } |
|
60 else if (this.myFilter.equals(Messages.getString("PIFileFilter.txtFilter"))) //$NON-NLS-1$ |
|
61 { |
|
62 return Messages.getString("PIFileFilter.txtDescription"); //$NON-NLS-1$ |
|
63 } |
|
64 else |
|
65 { |
|
66 return Messages.getString("PIFileFilter.noDescription1") + myFilter + Messages.getString("PIFileFilter.noDescription2"); //$NON-NLS-1$ //$NON-NLS-2$ |
|
67 } |
|
68 } |
|
69 } |