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    
005    package graphlab.plugins;
006    
007    import graphlab.graph.ui.GTabbedGraphPane;
008    import graphlab.plugins.main.GraphData;
009    import graphlab.plugins.main.extension.GraphActionExtension;
010    
011    import javax.swing.*;
012    import java.io.File;
013    
014    /**
015     * @author Ali Ershadi
016     */
017    public class FileOpener implements GraphActionExtension {
018        public String getName() {
019            return "File Opener";
020        }
021    
022        public String getDescription() {
023            return "Text File Opener";
024        }
025    
026        public void action(GraphData gd) {
027            GTabbedGraphPane gtgp = gd.getBlackboard().getData(GTabbedGraphPane.NAME);
028            JFileChooser fc = new JFileChooser("");
029            fc.showOpenDialog(new JFrame());
030            File f = new File(fc.getSelectedFile().getAbsolutePath());
031    //        gtgp.add(f, f.getName());
032        }
033    }