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.main.core.actions; 005 006 import graphlab.graph.ui.GTabbedGraphPane; 007 import graphlab.platform.core.AbstractAction; 008 import graphlab.platform.core.BlackBoard; 009 import graphlab.ui.UIUtils; 010 011 /** 012 * @author azin azadi 013 */ 014 public class CloseTab extends AbstractAction { 015 /** 016 * constructor 017 * 018 * @param bb the blackboard of the action 019 */ 020 public CloseTab(BlackBoard bb) { 021 super(bb); 022 listen4Event(UIUtils.getUIEventKey("close tab")); 023 } 024 025 public void performAction(String eventName, Object value) { 026 dojob(blackboard); 027 } 028 029 /** 030 * removes the current tab from current editing graph window 031 */ 032 public static void dojob(BlackBoard blackboard) { 033 GTabbedGraphPane gtgp = blackboard.getData(GTabbedGraphPane.NAME); 034 gtgp.getTabedPane().remove(gtgp.getTabedPane().getSelectedIndex()); 035 //todo: ask for save before close 036 } 037 }