/** * Executes this action. * * @param parent the parent window */ public void execute(Window parent) { File f = new File(fileName); try { SignatureFileInfo info = signatureManager.upload(type, f, useAsDefault); String message = String.format("Signature file %s has been uploaded", info.getFile().getName()); JOptionPane.showMessageDialog( parent, message, "Signature file uploaded", JOptionPane.INFORMATION_MESSAGE); } catch (SignatureFileException e) { JOptionPane.showMessageDialog( parent, e.getMessage(), "Error uploading signature file", JOptionPane.ERROR_MESSAGE); } }
/** @throws CommandExecutionException */ private void updateDefaultVersion(String key) throws CommandExecutionException { final PropertiesConfiguration properties = globalConfig.getProperties(); properties.setProperty(mapping.get(type).getName(), key); try { properties.save(); SignatureFileInfo sigFileInfo = signatureManager.getDefaultSignatures().get(type); printWriter.println( I18N.getResource( I18N.CONFIGURE_SIGNATURE_FILE_VERSION_SUCCESS, sigFileInfo.getVersion(), sigFileInfo.getFile().getName())); } catch (ConfigurationException e) { throw new CommandExecutionException(e); } catch (SignatureFileException e) { throw new CommandExecutionException(e); } };