localizer.getTooltip(HelperResource.RES_ACTION_OK), localizer.getMnemonic(HelperResource.RES_ACTION_OK));
}
@Override
public void actionPerformed(final ActionEvent e) {
final Worker worker = new WorkerAbstract<Void, Void>() {
@Override
protected Void doInBackground() throws Exception {
fireWorkerStart();
try {
final CryptoSymmetricAlgo algo = (CryptoSymmetricAlgo) cbCodecs.getSelectedItem();
final CryptoSymmetric crypto = new CryptoSymmetricImpl(algo);
final SecretKey key = crypto.generateKey(new String(password1.getPassword())
.getBytes(Constants.ENCODING_DEFAULT));
crypto.encrypt(scrambler.getModuleData().getFile(KEY_SCRAMBLE_INPUT), scrambler.getModuleData()
.getFile(KEY_SCRAMBLE_OUTPUT), key);
scrambler.getModuleData().addValue(KEY_SCRAMBLE_ALGO, algo);
// } catch (IOException ex) {
// log.error("Could not scramble file", ex); //$NON-NLS-1$
// scrambler
// .displayMessage(scrambler.getModel().getName(), "Could not scramble file", MessageType.ERROR);
} catch (Exception ex) {
log.error("Could not scramble file", ex); //$NON-NLS-1$
scrambler
.displayMessage(scrambler.getModel().getName(), localizer.getValue(HelperResource.RES_ERROR_SCRAMBLE), MessageType.ERROR);
}
return null;
}
};
worker.addListener(scrambler);
scrambler.getCallback().addWorker(
worker,
localizer.getValue(HelperResource.RES_ACTION_SCRAMBLE),
scrambler.getModuleData().getFile(KEY_SCRAMBLE_INPUT).getName()
+ " -> " + scrambler.getModuleData().getFile(KEY_SCRAMBLE_OUTPUT).getName(), Icons.SCRAMBLE); //$NON-NLS-1$