Search in sources :

Example 1 with IUndoHandler

use of org.freeplane.core.undo.IUndoHandler in project freeplane by freeplane.

the class MModeController method delayedRollback.

public void delayedRollback() {
    final MMapModel map = (MMapModel) getController().getMap();
    final IUndoHandler undoHandler = map.getExtension(IUndoHandler.class);
    undoHandler.delayedRollback();
}
Also used : MMapModel(org.freeplane.features.map.mindmapmode.MMapModel) IUndoHandler(org.freeplane.core.undo.IUndoHandler)

Example 2 with IUndoHandler

use of org.freeplane.core.undo.IUndoHandler in project freeplane by freeplane.

the class MModeController method delayedCommit.

public void delayedCommit() {
    final MMapModel map = (MMapModel) getController().getMap();
    final IUndoHandler undoHandler = map.getExtension(IUndoHandler.class);
    undoHandler.delayedCommit();
}
Also used : MMapModel(org.freeplane.features.map.mindmapmode.MMapModel) IUndoHandler(org.freeplane.core.undo.IUndoHandler)

Example 3 with IUndoHandler

use of org.freeplane.core.undo.IUndoHandler in project freeplane by freeplane.

the class MModeController method forceNewTransaction.

@Override
public void forceNewTransaction() {
    final MapModel map = getController().getMap();
    final IUndoHandler undoHandler = map.getExtension(IUndoHandler.class);
    undoHandler.forceNewTransaction();
}
Also used : IUndoHandler(org.freeplane.core.undo.IUndoHandler) MMapModel(org.freeplane.features.map.mindmapmode.MMapModel) MapModel(org.freeplane.features.map.MapModel)

Example 4 with IUndoHandler

use of org.freeplane.core.undo.IUndoHandler in project freeplane by freeplane.

the class ModeController method undoableCopyExtensions.

public void undoableCopyExtensions(final Object key, final NodeModel from, final NodeModel to) {
    final MapModel map = to.getMap();
    if (map == null) {
        copyExtensions(key, from, to);
        return;
    }
    final IUndoHandler undoHandler = map.getExtension(IUndoHandler.class);
    if (undoHandler == null) {
        copyExtensions(key, from, to);
        return;
    }
    final NodeModel backup = new NodeModel(null);
    copyExtensions(key, to, backup);
    final IActor actor = new IActor() {

        public void undo() {
            removeExtensions(key, to);
            copyExtensions(key, backup, to);
            getMapController().nodeChanged(to);
        }

        public String getDescription() {
            return "undoableCopyExtensions";
        }

        public void act() {
            copyExtensions(key, from, to);
            getMapController().nodeChanged(to);
        }
    };
    execute(actor, map);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) IActor(org.freeplane.core.undo.IActor) IUndoHandler(org.freeplane.core.undo.IUndoHandler) MapModel(org.freeplane.features.map.MapModel)

Example 5 with IUndoHandler

use of org.freeplane.core.undo.IUndoHandler in project freeplane by freeplane.

the class ModeController method undoableResolveParentExtensions.

public void undoableResolveParentExtensions(final Object key, final NodeModel to) {
    final MapModel map = to.getMap();
    if (map == null) {
        resolveParentExtensions(key, to);
        return;
    }
    final IUndoHandler undoHandler = map.getExtension(IUndoHandler.class);
    if (undoHandler == null) {
        resolveParentExtensions(key, to);
        return;
    }
    final NodeModel backup = new NodeModel(null);
    copyExtensions(key, to, backup);
    final IActor actor = new IActor() {

        public void undo() {
            copyExtensions(key, backup, to);
            getMapController().nodeChanged(to);
        }

        public String getDescription() {
            return "undoableCopyExtensions";
        }

        public void act() {
            resolveParentExtensions(key, to);
            getMapController().nodeChanged(to);
        }
    };
    execute(actor, map);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) IActor(org.freeplane.core.undo.IActor) IUndoHandler(org.freeplane.core.undo.IUndoHandler) MapModel(org.freeplane.features.map.MapModel)

Aggregations

IUndoHandler (org.freeplane.core.undo.IUndoHandler)21 MapModel (org.freeplane.features.map.MapModel)15 MMapModel (org.freeplane.features.map.mindmapmode.MMapModel)10 Controller (org.freeplane.features.mode.Controller)4 IActor (org.freeplane.core.undo.IActor)3 NodeModel (org.freeplane.features.map.NodeModel)3 IMapViewManager (org.freeplane.features.ui.IMapViewManager)3 ModeController (org.freeplane.features.mode.ModeController)2 LogicalStyleController (org.freeplane.features.styles.LogicalStyleController)2 ViewController (org.freeplane.features.ui.ViewController)2 Component (java.awt.Component)1 Window (java.awt.Window)1 ComponentAdapter (java.awt.event.ComponentAdapter)1 ComponentEvent (java.awt.event.ComponentEvent)1 WindowAdapter (java.awt.event.WindowAdapter)1 WindowEvent (java.awt.event.WindowEvent)1 JDialog (javax.swing.JDialog)1 WindowConfigurationStorage (org.freeplane.core.resources.WindowConfigurationStorage)1 MapStyleModel (org.freeplane.features.styles.MapStyleModel)1