package com.digero.common.util;

import java.io.File;
import java.util.regex.Pattern;

public class ExtensionFileFilter extends javax.swing.filechooser.FileFilter implements java.io.FileFilter {
	private Pattern fileNameRegex;
	private String description;

	public ExtensionFileFilter(String description, String... fileTypes) {
		this.description = description;

		String regex = ".*\\.(" + fileTypes[0];
		for (int i = 1; i < fileTypes.length; i++)
			regex += "|" + fileTypes[i];
		regex += ")$";
		fileNameRegex = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
	}

	@Override
	public boolean accept(File f) {
		if (f.isDirectory())
			return true;

		return fileNameRegex.matcher(f.getName()).matches();
	}

	@Override
	public String getDescription() {
		return description;
	}

}

@@ -252,24 +252,60 @@
 escription;%0D
+%0A%09private boolean matchDirectories;%0D
 %0A%0D%0A%09public E
@@ -377,34 +377,222 @@
 this
-.description = description
+(description, true, fileTypes);%0D%0A%09%7D%0D%0A%0D%0A%09public ExtensionFileFilter(String description, boolean matchDirectories, String... fileTypes) %7B%0D%0A%09%09this.description = description;%0D%0A%09%09this.matchDirectories = matchDirectories
 ;%0D%0A%0D
@@ -887,20 +887,32 @@
 %09return 
-true
+matchDirectories
 ;%0D%0A%0D%0A%09%09r

Add match directories flag to ExtensionFileFilter