]>
git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/ModuleEditor/src/org/tianocore/common/IFileFilter.java
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
.common
;
20 import javax
.swing
.filechooser
.FileFilter
;
23 The class is used to override FileFilter to provides customized interfaces
25 @since ModuleEditor 1.0
28 public class IFileFilter
extends FileFilter
{
30 private String strExt
;
38 public static void main(String
[] args
) {
39 // TODO Auto-generated method stub
44 This is the default constructor
49 public IFileFilter(String ext
) {
54 * @see javax.swing.filechooser.FileFilter#accept(java.io.File)
56 * Override method "accept"
59 public boolean accept(File file
) {
60 if (file
.isDirectory()) {
63 String strFileName
= file
.getName();
64 int intIndex
= strFileName
.lastIndexOf('.');
65 if (intIndex
> 0 && intIndex
< strFileName
.length() - 1) {
66 String strExtension
= strFileName
.substring(intIndex
+ 1).toLowerCase();
67 if (strExtension
.equals(strExt
))
74 * @see javax.swing.filechooser.FileFilter#getDescription()
76 * Override method "getDescription" to config description via different file type
79 public String
getDescription() {
80 if (strExt
.equals("msa"))
81 return "Module Surface Area File(*.msa)";
82 if (strExt
.equals("mbd"))
83 return "Module Build Description File(*.mbd)";