}
});
}
public void toggleCryptState(final NodeModel node, PasswordStrategy passwordStrategy) {
final EncryptionModel encryptionModel = EncryptionModel.getModel(node);
if (encryptionModel != null) {
final boolean wasAccessible = encryptionModel.isAccessible();
final boolean wasFolded = node.isFolded();
if (wasAccessible) {
encryptionModel.setAccessible(false);
encryptionModel.getEncryptedContent(Controller.getCurrentModeController().getMapController());
node.setFolded(true);
}
else {
if (doPasswordCheckAndDecryptNode(encryptionModel, passwordStrategy)) {
node.setFolded(false);
}
else {
return;
}
}
Controller.getCurrentController().getSelection().selectAsTheOnlyOneSelected(node);
final IActor actor = new IActor() {
public void act() {
encryptionModel.setAccessible(!wasAccessible);
if (wasAccessible) {
node.setFolded(true);
}
Controller.getCurrentModeController().getMapController().nodeRefresh(node);
}
public String getDescription() {
return "toggleCryptState";
}
public void undo() {
encryptionModel.setAccessible(wasAccessible);
if (wasAccessible) {
node.setFolded(wasFolded);
}
Controller.getCurrentModeController().getMapController().nodeRefresh(node);
}