ccs.cpc
Class PluginRuntime

java.lang.Object
  extended by ccs.cpc.ViewerRuntime
      extended by ccs.cpc.PluginRuntime
Direct Known Subclasses:
ArchOpener, JarOpener, ResultsOpener

public abstract class PluginRuntime
extends ViewerRuntime


Field Summary
protected  PluginCallback callback
           
protected  Plugin plugin
           
 
Fields inherited from class ccs.cpc.ViewerRuntime
target
 
Constructor Summary
PluginRuntime()
          Create an PluginRuntime to view this VFile.
 
Method Summary
static Viewer.FileCap getFileness()
          The plugin's file-handling capability.
static java.lang.String getName()
          The plugin's user-visible name.
 Plugin getPlugin()
          Returns our (invariant) Plugin.
static boolean isEditor()
          Whether this plugin edits its source VFile.
 javax.swing.ImageIcon loadIcon(java.lang.String path)
          Load an icon from the CPC chrome CDB.
 void pluginFinished()
          Plugins must call this when they terminate normally or are killed.
 ProfileModelElement readModel(java.lang.String classname, java.lang.String key)
          Retrieves the plugin's ProfileModelElement (containing its persistent state), if any.
 void setResources(PluginCallback callback, VFile target, Plugin plugin)
          Set the resources that the viewer will need.
 void waitFor()
          Block the reaper thread until we're ready.
 void writeModel(ProfileModelElement element)
          Adds the supplied ProfileModelElement (containing the plugin's persistent state) to the profile (if not already present), and stores it.
 
Methods inherited from class ccs.cpc.ViewerRuntime
cleanup, getTarget, kill, launch, setTarget
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

callback

protected PluginCallback callback

plugin

protected Plugin plugin
Constructor Detail

PluginRuntime

public PluginRuntime()
Create an PluginRuntime to view this VFile. We use this two-stage process (create then set resources) because subclasses will called through reflection, and it's a lot easier to have a parameterless ctor for that kind of deal. Note: the callback is unavailable until launch() time.

Method Detail

setResources

public final void setResources(PluginCallback callback,
                               VFile target,
                               Plugin plugin)
Set the resources that the viewer will need. Reserved.


pluginFinished

public final void pluginFinished()
Plugins must call this when they terminate normally or are killed.


waitFor

public final void waitFor()
                   throws java.lang.InterruptedException
Block the reaper thread until we're ready.

Specified by:
waitFor in class ViewerRuntime
Throws:
java.lang.InterruptedException

getPlugin

public final Plugin getPlugin()
Returns our (invariant) Plugin.


writeModel

public final void writeModel(ProfileModelElement element)
Adds the supplied ProfileModelElement (containing the plugin's persistent state) to the profile (if not already present), and stores it.


readModel

public final ProfileModelElement readModel(java.lang.String classname,
                                           java.lang.String key)
Retrieves the plugin's ProfileModelElement (containing its persistent state), if any. (Else null).

Parameters:
classname - The name of the class containing this viewer's model. Must implement ProfileModelElement.
key - An extra distinguisher which allows several instances of the same class to be stored. This might be useful where several related viewers use the same class to store their model data. If not used (the usual case), must be the empty string.

loadIcon

public final javax.swing.ImageIcon loadIcon(java.lang.String path)
Load an icon from the CPC chrome CDB.

Parameters:
path - The path of the icon file within the CDB.
Returns:
the Icon, if available, or an empty icon if the load fails.

isEditor

public static boolean isEditor()
Whether this plugin edits its source VFile. (Enquiring punters wish to know; CPC also needs to know for helper apps, but plugins control VFile load / save themselves.) The default is that it does not.


getFileness

public static Viewer.FileCap getFileness()
The plugin's file-handling capability. The default is that a file is required, ie. Viewer.WITH.


getName

public static java.lang.String getName()
The plugin's user-visible name. The default is a placeholder, and must be overridden.