001 // GraphLab Project: http://graphlab.sharif.edu 002 // Copyright (C) 2008 Mathematical Science Department of Sharif University of Technology 003 // Distributed under the terms of the GNU General Public License (GPL): http://www.gnu.org/licenses/ 004 package graphlab.plugins.commonplugin.undo; 005 006 import graphlab.platform.core.BlackBoard; 007 008 import java.util.HashMap; 009 010 /** 011 * @author Ruzbeh Ebrahimi 012 */ 013 public class UndoableActionOccuredData { 014 public static final String EVENT_KEY = "UndoableAction.Occured"; 015 public Undoable undoableAction; 016 public HashMap<String, Object> properties; 017 018 public UndoableActionOccuredData(Undoable undoableAction) { 019 properties = new HashMap<String, Object>(); 020 this.undoableAction = undoableAction; 021 } 022 023 /** 024 * puts data in the stack of undo/redo actions, so it will be regarded as an undoable action and will be undone by the rules of undo/redo. 025 */ 026 public static void addUndoData(BlackBoard blackboard, UndoableActionOccuredData data) { 027 blackboard.setData(EVENT_KEY, data); 028 } 029 }