001package plugins.tutorial.basics;
002
003import icy.gui.frame.progress.AnnounceFrame;
004import icy.plugin.abstract_.PluginActionable;
005import icy.plugin.interface_.PluginThreaded;
006
007/**
008 * This tutorial just create a bug to watch the bug report window in action
009 * To make it harder to catch by ICY, we add the PluginStartAsThread interface, which starts the
010 * plugin as a thread.
011 * 
012 * @author Fabrice de Chaumont
013 * @author Stephane Dallongeville
014 */
015public class GenerateABugTutorial extends PluginActionable implements PluginThreaded
016{
017    @Override
018    public void run()
019    {
020        new AnnounceFrame("This plugin will crash in 3 seconds to show the automatic bug report feature.");
021        new AnnounceFrame("To make it difficult to catch, the error is within a thread.");
022
023        try
024        {
025            Thread.sleep(3000);
026        }
027        catch (InterruptedException e)
028        {
029            e.printStackTrace();
030        }
031
032        // generate an exception
033        throw new NullPointerException();
034    }
035}