((MLinkController) LinkController.getController()).setLink(existingNode,
oldUri, LinkController.LINK_ABSOLUTE);
final int nodePosition = parent.getChildPosition(existingNode);
final ModeController modeController = Controller.getCurrentModeController();
modeController.undoableResolveParentExtensions(LogicalStyleKeys.NODE_STYLE, existingNode);
final MMapController mMapController = (MMapController) modeController.getMapController();
mMapController.deleteNode(existingNode);
{
final IActor actor = new IActor() {
private final boolean wasFolded = existingNode.isFolded();
public void undo() {
PersistentNodeHook.removeMapExtensions(existingNode);
existingNode.setMap(parentMap);
existingNode.setFolded(wasFolded);
}
public String getDescription() {
return "ExportBranchAction";
}
public void act() {
existingNode.setParent(null);
existingNode.setFolded(false);
mMapController.newModel(existingNode);
}
};
Controller.getCurrentModeController().execute(actor, parentMap);
}
final MapModel map = existingNode.getMap();
IExtension[] oldExtensions = map.getRootNode().getSharedExtensions().values().toArray(new IExtension[]{});
for(final IExtension extension : oldExtensions){
final Class<? extends IExtension> clazz = extension.getClass();
if(PersistentNodeHook.isMapExtension(clazz)){
existingNode.removeExtension(clazz);
}
}
final Collection<IExtension> newExtensions = parentMap.getRootNode().getSharedExtensions().values();
for(final IExtension extension : newExtensions){
final Class<? extends IExtension> clazz = extension.getClass();
if(PersistentNodeHook.isMapExtension(clazz)){
existingNode.addExtension(extension);
}
}
((MFileManager) UrlManager.getController()).save(map, chosenFile);
final NodeModel newNode = mMapController.addNewNode(parent, nodePosition, existingNode.isLeft());
((MTextController) TextController.getController()).setNodeText(newNode, existingNode.getText());
modeController.undoableCopyExtensions(LogicalStyleKeys.NODE_STYLE, existingNode, newNode);
map.getFile();
((MLinkController) LinkController.getController()).setLink(newNode, newUri, LinkController.LINK_ABSOLUTE);
map.destroy();