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.algorithmanimator;
005    
006    import graphlab.platform.core.BlackBoard;
007    import graphlab.platform.extension.ExtensionLoader;
008    import graphlab.platform.plugin.PluginInterface;
009    import graphlab.plugins.algorithmanimator.core.atoms.extension.AtomAnimatorExtensionHandler;
010    import graphlab.plugins.algorithmanimator.extension.AlgorithmExtensionHandler;
011    import graphlab.ui.UI;
012    import org.xml.sax.SAXException;
013    
014    import java.io.IOException;
015    
016    /**
017     * @author Reza Mohammadi
018     */
019    public class Init implements PluginInterface {
020        static {
021            ExtensionLoader.registerExtensionHandler(new AlgorithmExtensionHandler());
022            ExtensionLoader.registerExtensionHandler(new AtomAnimatorExtensionHandler());
023        }
024    
025        public void init(BlackBoard blackboard) {
026            UI ui = (UI) blackboard.getData(UI.name);
027            try {
028                ui.addXML("/graphlab/plugins/algorithmanimator/config.xml", getClass());
029            } catch (IOException e) {
030                e.printStackTrace();
031                System.out.println("xml file was not found , or IO error");
032            } catch (SAXException e) {
033                e.printStackTrace();
034            }
035        }
036    }