3 The file is used to override FileFilter to provides customized interfaces
5 Copyright (c) 2006, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 package org
.tianocore
.frameworkwizard
.common
;
20 import javax
.swing
.filechooser
.FileFilter
;
23 The class is used to override FileFilter to provides customized interfaces
26 public class IFileFilter
extends FileFilter
{
28 private String strExt
;
36 public static void main(String
[] args
) {
37 // TODO Auto-generated method stub
42 This is the default constructor
47 public IFileFilter(String ext
) {
52 * @see javax.swing.filechooser.FileFilter#accept(java.io.File)
54 * Override method "accept"
57 public boolean accept(File file
) {
58 if (file
.isDirectory()) {
61 String strFileName
= file
.getName();
62 int intIndex
= strFileName
.lastIndexOf('.');
63 if (intIndex
> 0 && intIndex
< strFileName
.length() - 1) {
64 String strExtension
= strFileName
.substring(intIndex
+ 1).toLowerCase();
65 if (strExtension
.equals(strExt
))
72 * @see javax.swing.filechooser.FileFilter#getDescription()
74 * Override method "getDescription" to config description via different file type
77 public String
getDescription() {
78 if (strExt
.equals(DataType
.MODULE_SURFACE_AREA_EXT
))
79 return DataType
.MODULE_SURFACE_AREA_EXT_DESCRIPTION
;
80 if (strExt
.equals(DataType
.PACKAGE_SURFACE_AREA_EXT
))
81 return DataType
.PACKAGE_SURFACE_AREA_EXT_DESCRIPTION
;
82 if (strExt
.equals(DataType
.PLATFORM_SURFACE_AREA_EXT
))
83 return DataType
.PLATFORM_SURFACE_AREA_EXT_DESCRIPTION
;
84 if (strExt
.equals(DataType
.TEXT_FILE_EXT
))
85 return DataType
.TEXT_FILE_EXT_DESCRIPTION
;
86 if (strExt
.equals(DataType
.FAR_SURFACE_AREA_EXT
))
87 return DataType
.FAR_SURFACE_AREA_EXT_DESCRIPTION
;