package leaf.ui;

import static com.evolute.utils.strings.UnicodeLatin1Map.atilde;
import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil;

import javax.swing.JOptionPane;

import com.evolute.utils.error.ErrorLogger;
import com.evolute.utils.ui.DialogException;

public class LeafDialog
{
	
	public static void error( Exception e )
	{
		if( e != null )
		{
			ErrorLogger.logException( e );
			e.printStackTrace( System.out );
			DialogException.showException( e );
		}
	}
	
	public static boolean confirmDelete( boolean masculino, boolean plural, String nome )
	{
		return JOptionPane.OK_OPTION == JOptionPane.showConfirmDialog(
				null,
				"Tem a certeza que deseja remover " +
				( masculino ? "o" : "a" ) +
				( plural ? "s" : "" ) +
				" " + nome + " seleccionad" +
				( masculino ? "o" : "a" ) +
				( plural ? "s" : "" ) +
				"?",
				"Confirmar remo" + ccedil + atilde + "o",
				JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null );
	}
	
}
