use of org.freeplane.core.undo.IUndoHandler in project freeplane by freeplane.
the class ModeController method undoableRemoveExtensions.
public void undoableRemoveExtensions(final Object key, final NodeModel from, final NodeModel which) {
final MapModel map = from.getMap();
if (map == null) {
removeExtensions(key, from, which);
return;
}
final IUndoHandler undoHandler = map.getExtension(IUndoHandler.class);
if (undoHandler == null) {
removeExtensions(key, from, which);
return;
}
final NodeModel backup = new NodeModel(null);
copyExtensions(key, from, backup);
final IActor actor = new IActor() {
public void undo() {
copyExtensions(key, backup, from);
getMapController().nodeChanged(from);
}
public String getDescription() {
return "undoableCopyExtensions";
}
public void act() {
removeExtensions(key, from, which);
getMapController().nodeChanged(from);
}
};
execute(actor, map);
}
Aggregations