001 package nl.cwi.sen1.gui.plugin;
002
003 import nl.cwi.sen1.gui.Studio;
004
005 /**
006 * A plugin for the MetaStudio. A plugin is a program that is dynamically
007 * loaded into the MetaStudio, and runs in its own thread. The thread is
008 * started with a call to @see #initStudioPlugin(Studio studio).
009 */
010 public interface StudioPlugin {
011 /**
012 * Get the name of a plugin. This is used to construct proper names
013 * of threads and to construct meaningfull error messages. Pick a unique
014 * name.
015 * @return The name of a plugin.
016 */
017 public String getName();
018
019 /**
020 * The main method of a plugin. This method is provided a reference to
021 * the toplevel window, and the ToolBus, via the @see Studio interface.
022 * @param studio Reference to functionality of the toplevel window.
023 */
024 public void initStudioPlugin(Studio studio);
025
026 /**
027 * Register a listener. The Studio listens to important events from all
028 * plugins. The functionality of the whole Studio may break if the
029 * observer pattern is not implemented correctly here.
030 * @see DefaultStudioPlugin provides a default implementation.
031 * @param l An implementation of a listener (usually the studio itself).
032 */
033 public void addStudioPluginListener(StudioPluginListener l);
034
035 /**
036 * Unregister a listener.
037 * @param l Listener to be unregistered.
038 */
039 public void removeStudioPluginListener(StudioPluginListener l);
040 }