try
{
Logger.info("creating new key in " + f);
if (f == null)
{
Application.getMessagingFactory().sendMessage(new StatusBarMessage(i18n.tr("Bitte w�hlen Sie eine Schl�sseldatei aus"),StatusBarMessage.TYPE_ERROR));
return;
}
final int ft = KeyFormat.FEATURE_CREATE;
KeyFormat[] formats = RDHKeyFactory.getKeyFormats(ft);
KeyFormat format = null;
if (formats != null && formats.length == 1)
{
format = formats[0];
Logger.info("only have one key format, that supports creation of new keys, choosing this one automatically: " + format.getName());
}
else
{
Logger.info("asking user which key format to be used");
KeyFormatDialog d = new KeyFormatDialog(KeyFormatDialog.POSITION_CENTER,ft);
format = (KeyFormat) d.open();
}
addKey(format.createKey(f));
Application.getMessagingFactory().sendMessage(new StatusBarMessage(i18n.tr("Schl�sseldatei erfolgreich erstellt"),StatusBarMessage.TYPE_SUCCESS));
}
catch (OperationCanceledException oce)
{
Logger.warn("operation cancelled; " + oce.getMessage());
throw oce;
}
catch (final ApplicationException ae)
{
Logger.error(ae.getMessage());
// Meldung wurde sonst nicht in der GUI angezeigt. Siehe http://www.onlinebanking-forum.de/forum/topic.php?p=106085#real106085
GUI.getDisplay().asyncExec(new Runnable() {
public void run()
{
Application.getMessagingFactory().sendMessage(new StatusBarMessage(ae.getMessage(),StatusBarMessage.TYPE_ERROR));
}
});
}
catch (Throwable t)
{
Logger.error("error while creating key",t);
Application.getMessagingFactory().sendMessage(new StatusBarMessage(i18n.tr("Fehler beim Erzeugen des Schl�ssels: {0}",t.getMessage()),StatusBarMessage.TYPE_ERROR));
}
}