// Path: src/main/net/sf/portecle/FPortecle.java
// public static final ResourceBundle RB = ResourceBundle.getBundle(RB_BASENAME);
// 
// Path: src/main/net/sf/portecle/crypto/ProviderUtil.java
// public final class ProviderUtil
// {
// 	/**
// 	 * Private to prevent construction.
// 	 */
// 	private ProviderUtil()
// 	{
// 		// Nothing to do
// 	}
// 
// 	/**
// 	 * Get the PKCS #11 <code>Provider</code>s available on the system.
// 	 *
// 	 * @return the (possibly empty) collection of available PKCS #11 <code>Provider</code>s, sorted by name
// 	 */
// 	public static Collection<Provider> getPkcs11Providers()
// 	{
// 		TreeMap<String, Provider> p11s = new TreeMap<>();
// 		for (Provider prov : Security.getProviders())
// 		{
// 			String pName = prov.getName();
// 			// Is it a PKCS #11 provider?
// 			/*
// 			 * TODO: is there a better way to find out? Could try instanceof sun.security.pkcs11.SunPKCS11 but that
// 			 * would require the class to be available?
// 			 */
// 			if (pName.startsWith("SunPKCS11-"))
// 			{
// 				p11s.put(pName, prov);
// 			}
// 		}
// 		return p11s.values();
// 	}
// }


import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import net.sf.portecle.crypto.ProviderUtil;
import static net.sf.portecle.FPortecle.RB;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Window;
import java.security.Provider;
import java.security.Security;
import java.text.MessageFormat;
import java.util.Collection;
/*
 * DChoosePkcs11Provider.java
 * This file is part of Portecle, a multipurpose keystore and certificate tool.
 *
 * Copyright © 2004-2008 Ville Skyttä, ville.skytta@iki.fi
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA.
 */

package net.sf.portecle;





/**
 * Modal dialog used for choosing a PKCS #11 provider.
 *
 * @author Ville Skyttä
 */
/* package private */class DChoosePkcs11Provider
    extends PortecleJDialog
{
	/** Provider drop-down box */
	private JComboBox<String> m_jcbProvider;

	/** Stores the provider chosen by the user */
	private String m_sProvider;

	/**
	 * Creates new DChoosePkcs11Provider dialog.
	 *
	 * @param parent The parent window
	 * @param sTitle The dialog's title
	 * @param sOldProvider The provider to display initially
	 */
	public DChoosePkcs11Provider(Window parent, String sTitle, String sOldProvider)
	{
		super(parent, sTitle, true);
		initComponents(sOldProvider);
	}

	/**
	 * Get the provider chosen by the user.
	 *
	 * @return The provider, or null if none was entered
	 */
	public String getProvider()
	{
// Path: src/main/net/sf/portecle/FPortecle.java
// public static final ResourceBundle RB = ResourceBundle.getBundle(RB_BASENAME);
// 
// Path: src/main/net/sf/portecle/crypto/ProviderUtil.java
// public final class ProviderUtil
// {
// 	/**
// 	 * Private to prevent construction.
// 	 */
// 	private ProviderUtil()
// 	{
// 		// Nothing to do
// 	}
// 
// 	/**
// 	 * Get the PKCS #11 <code>Provider</code>s available on the system.
// 	 *
// 	 * @return the (possibly empty) collection of available PKCS #11 <code>Provider</code>s, sorted by name
// 	 */
// 	public static Collection<Provider> getPkcs11Providers()
// 	{
// 		TreeMap<String, Provider> p11s = new TreeMap<>();
// 		for (Provider prov : Security.getProviders())
// 		{
// 			String pName = prov.getName();
// 			// Is it a PKCS #11 provider?
// 			/*
// 			 * TODO: is there a better way to find out? Could try instanceof sun.security.pkcs11.SunPKCS11 but that
// 			 * would require the class to be available?
// 			 */
// 			if (pName.startsWith("SunPKCS11-"))
// 			{
// 				p11s.put(pName, prov);
// 			}
// 		}
// 		return p11s.values();
// 	}
// }


// Path: src/main/net/sf/portecle/DChoosePkcs11Provider.java
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import net.sf.portecle.crypto.ProviderUtil;
import static net.sf.portecle.FPortecle.RB;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Window;
import java.security.Provider;
import java.security.Security;
import java.text.MessageFormat;
import java.util.Collection;

/*
 * DChoosePkcs11Provider.java
 * This file is part of Portecle, a multipurpose keystore and certificate tool.
 *
 * Copyright © 2004-2008 Ville Skyttä, ville.skytta@iki.fi
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA.
 */

package net.sf.portecle;





/**
 * Modal dialog used for choosing a PKCS #11 provider.
 *
 * @author Ville Skyttä
 */
/* package private */class DChoosePkcs11Provider
    extends PortecleJDialog
{
	/** Provider drop-down box */
	private JComboBox<String> m_jcbProvider;

	/** Stores the provider chosen by the user */
	private String m_sProvider;

	/**
	 * Creates new DChoosePkcs11Provider dialog.
	 *
	 * @param parent The parent window
	 * @param sTitle The dialog's title
	 * @param sOldProvider The provider to display initially
	 */
	public DChoosePkcs11Provider(Window parent, String sTitle, String sOldProvider)
	{
		super(parent, sTitle, true);
		initComponents(sOldProvider);
	}

	/**
	 * Get the provider chosen by the user.
	 *
	 * @return The provider, or null if none was entered
	 */
	public String getProvider()
	{
		return m_sProvider;