package com.intuit.tank.proxy.settings.ui; /* * #%L * proxy-extension * %% * Copyright (C) 2011 - 2015 Intuit Inc. * %% * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * #L% */ import java.io.File; import javax.swing.filechooser.FileFilter; public class XmlFileFilter extends FileFilter { @Override public String getDescription() { return "Just XML"; } @Override public boolean accept(File f) { if (f.isDirectory()) { return true; } String ext = null; String s = f.getName(); int i = s.lastIndexOf('.'); if (i > 0 && i < s.length() - 1) { ext = s.substring(i + 1).toLowerCase(); } if (ext != null) { if (ext.equals("xml")) { return true; } else { return false; } } return false; } }