net.imagej.patcher
Class EssentialLegacyHooks

java.lang.Object
  extended by net.imagej.patcher.LegacyHooks
      extended by net.imagej.patcher.EssentialLegacyHooks

public class EssentialLegacyHooks
extends LegacyHooks

The base LegacyHooks to be used in the patched ImageJ 1.x.

This is the minimal implementation of LegacyHooks and will be installed by default after patching in the extension points into ImageJ 1.x. On its own, it does not allow to override the extension points (such as the editor) with different implementations; one needs to install different hooks using the LegacyInjector.installHooks(ClassLoader, LegacyHooks) method.

This class is also the perfect base class for all implementations of the LegacyHooks interface, e.g. to offer "real" extension mechanisms such as the SciJava-common plugin framework.

Author:
Johannes Schindelin

Nested Class Summary
 
Nested classes/interfaces inherited from class net.imagej.patcher.LegacyHooks
LegacyHooks.FatJarNameComparator
 
Constructor Summary
EssentialLegacyHooks()
           
 
Method Summary
 void error(Throwable t)
          Shows an exception.
 void initialized()
          First extension point to run just after ImageJ 1.x spun up.
 Object interceptRunPlugIn(String className, String arg)
          Intercepts LegacyInitializer's Context creation.
static ClassLoader missingSubdirs(ClassLoader loader, boolean addPluginsDir)
          Intended for sole use with patches in IJ.
 
Methods inherited from class net.imagej.patcher.LegacyHooks
addMenuItem, addPluginClasspath, addPluginDirectory, autoGenerateConfigFile, autoGenerateConfigFile, createInEditor, debug, dispose, disposing, enableIJ1PluginDirs, getAppName, getAppVersion, getClasspathElements, getContext, getIconURL, getMenuStructure, getThreadAncestors, handleExtraPluginJars, handleNoSuchMethodError, installed, interceptCloseAllWindows, interceptDragAndDropFile, interceptFileOpen, interceptKeyPressed, interceptOpen, interceptOpenImage, interceptOpenRecent, isLegacyMode, log, newPluginClassLoader, openInEditor, quit, registerImage, runAfterRefreshMenus, showProgress, showProgress, showStatus, unregisterImage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EssentialLegacyHooks

public EssentialLegacyHooks()
Method Detail

error

public void error(Throwable t)
Description copied from class: LegacyHooks
Shows an exception.

Overrides:
error in class LegacyHooks
Parameters:
t - the exception

initialized

public void initialized()
Description copied from class: LegacyHooks
First extension point to run just after ImageJ 1.x spun up.

Overrides:
initialized in class LegacyHooks

missingSubdirs

public static ClassLoader missingSubdirs(ClassLoader loader,
                                         boolean addPluginsDir)
Intended for sole use with patches in IJ. DO NOT USE.


interceptRunPlugIn

public Object interceptRunPlugIn(String className,
                                 String arg)
Intercepts LegacyInitializer's Context creation.

One of the most critical code paths in Fiji is how its runtime patches get installed. It calls the LegacyEnvironment, of course, but the idea is for said environment to install the essential LegacyHooks which then give ImageJ's DefaultLegacyService a chance to spin up all of the legacy patches, including Fiji's (which are add-ons on top of imagej-legacy).

If this critical code path fails, Fiji fails to start up properly. Ideally, this should never happen, but this is not an ideal world: corrupt .jar files and version skews caused by forgotten updates, locally-modified files or simply by forward-incompatible downstream updates can break any number of things in that path. So let's bend over another inch (the existence of the ij1-patcher speaks volumes about our learned ability to do so) and try extra hard to keep things working even under very unfavorable circumstances.

Overrides:
interceptRunPlugIn in class LegacyHooks
Parameters:
className - the class name
arg - the argument passed to the runPlugIn method
Returns:
the object to return, or null to let ImageJ 1.x handle the call


Copyright © 2009–2014 ImageJ. All rights reserved.