CHESSIoT_Dev_old-master/org.polarsys.chess.iot.extension/src/org/polarsys/chess/iot/extension/uploadmodels/FileTypeFilter.java
package org.polarsys.chess.iot.extension.uploadmodels;
 
import java.io.File;
import javax.swing.filechooser.FileFilter;
 
public class FileTypeFilter extends FileFilter {
 
    private String extension;
    private String description;
     
    public FileTypeFilter(String extension, String description) {
        this.extension = extension;
        this.description = description;
    }
     
    @Override
    public boolean accept(File file) {
        if (file.isDirectory()) {
            return true;
        }
        return file.getName().toLowerCase().endsWith(extension);
    }
     
    public String getDescription() {
        return description + String.format(" (*%s)", extension);
    }
}