public class DefaultLegacyHooks extends LegacyHooks
LegacyHooks encapsulating an active LegacyService for use
within the patched ImageJ 1.x.LegacyHooks.FatJarNameComparator| Constructor and Description |
|---|
DefaultLegacyHooks(LegacyService legacyService) |
DefaultLegacyHooks(LegacyService legacyService,
IJ1Helper helper) |
| Modifier and Type | Method and Description |
|---|---|
void |
addMenuItem(String menuPath,
String command)
Callback for ImageJ 1.x' menu parsing machinery.
|
boolean |
createInEditor(String title,
String content)
Creates the given file in the registered legacy editor, if any.
|
void |
debug(String string)
Logs a debug message (to be shown only in debug mode).
|
void |
dispose()
Disposes of the hooks.
|
boolean |
disposing()
Allows interception of ImageJ 1.x's disposal routine while quitting.
|
void |
error(Throwable t)
Shows an exception.
|
String |
getAppName()
Returns the application name for use with ImageJ 1.x.
|
String |
getAppVersion()
Returns the application version to display in the ImageJ 1.x status bar.
|
Object |
getContext()
Returns the current context, if any.
|
URL |
getIconURL()
Returns the icon for use with ImageJ 1.x.
|
Iterable<Thread> |
getThreadAncestors()
Iterates through the current thread's ancestors.
|
void |
installed()
Runs when the hooks are installed into an existing legacy environment.
|
boolean |
interceptCloseAllWindows()
Allows closing additional windows at the end of
WindowManager.closeAllWindows(). |
Object |
interceptDragAndDropFile(File f)
Optionally override opening drag-and-dropped files via legacy hooks.
|
Object |
interceptFileOpen(String path)
Optionally override opening resources via legacy hooks.
|
void |
interceptImageWindowClose(Object window)
Hook to ensure
ImageWindows are fully cleaned up when
they are closed. |
boolean |
interceptKeyPressed(KeyEvent e)
Intercepts keyboard events sent to ImageJ 1.x.
|
Object |
interceptOpen(String path,
int planeIndex,
boolean display)
Optionally override opening resources via legacy hooks.
|
Object |
interceptOpenImage(String path,
int planeIndex)
Optionally override opening images via legacy hooks.
|
Object |
interceptOpenRecent(String path)
Optionally override opening recent images via legacy hooks.
|
Object |
interceptRunPlugIn(String className,
String arg)
Intercepts the call to
IJ.runPlugIn(String, String). |
boolean |
isLegacyMode()
Determines whether the image windows should be displayed or not.
|
void |
log(String message)
Logs a message.
|
boolean |
openInEditor(String path)
Opens the given path in the registered legacy editor, if any.
|
void |
registerImage(Object o)
Registers an image (possibly not seen before).
|
void |
runAfterRefreshMenus()
Extension point to run after Help>Refresh Menus
|
void |
unregisterImage(Object o)
Releases an image.
|
addPluginClasspath, addPluginDirectory, autoGenerateConfigFile, autoGenerateConfigFile, enableIJ1PluginDirs, getClasspathElements, getMenuStructure, handleExtraPluginJars, handleNoSuchMethodError, initialized, newPluginClassLoader, quit, showProgress, showProgress, showStatuspublic DefaultLegacyHooks(LegacyService legacyService)
public DefaultLegacyHooks(LegacyService legacyService, IJ1Helper helper)
public boolean isLegacyMode()
LegacyHooksisLegacyMode in class LegacyHookspublic Object getContext()
LegacyHooksFor ImageJ2-specific hooks, the returned object will be the current SciJava context, or null if the context is not yet initialized.
getContext in class LegacyHookspublic void installed()
LegacyHooksinstalled in class LegacyHookspublic void dispose()
LegacyHooksThis method is called when ImageJ 1.x is quitting or when new hooks are installed.
dispose in class LegacyHookspublic Object interceptRunPlugIn(String className, String arg)
LegacyHooksIJ.runPlugIn(String, String).interceptRunPlugIn in class LegacyHooksclassName - the class namearg - the argument passed to the runPlugIn methodpublic void registerImage(Object o)
LegacyHooksregisterImage in class LegacyHookso - the new imagepublic void unregisterImage(Object o)
LegacyHooksunregisterImage in class LegacyHookso - the imagepublic void debug(String string)
LegacyHooksdebug in class LegacyHooksstring - the debug messagepublic void error(Throwable t)
LegacyHookserror in class LegacyHookst - the exceptionpublic void log(String message)
LegacyHookslog in class LegacyHooksmessage - the messagepublic String getAppName()
getAppName in class LegacyHookspublic String getAppVersion()
getAppVersion in class LegacyHookspublic URL getIconURL()
getIconURL in class LegacyHookspublic void runAfterRefreshMenus()
LegacyHooksrunAfterRefreshMenus in class LegacyHookspublic boolean openInEditor(String path)
openInEditor in class LegacyHookspath - the path of the file to openpublic boolean createInEditor(String title, String content)
createInEditor in class LegacyHookstitle - the title of the file to createcontent - the text of the file to be createdpublic void addMenuItem(String menuPath, String command)
LegacyHooksThis method is called whenever ImageJ 1.x adds a command to the menu structure.
addMenuItem in class LegacyHooksmenuPath - the menu path of the menu item, or null when reinitializingcommand - the command associated with the menu item, or null when reinitializingpublic Object interceptOpen(String path, int planeIndex, boolean display)
LegacyHooksThis is intended as a "HandleExtraFileTypesPlus".
interceptOpen in class LegacyHookspath - the path to the resource to open, or null if a dialog
needs to be shownplaneIndex - If applicable - the index of plane to open or -1 for all planesdisplay - if true, the opened object should be displayed before returningnull to let ImageJ 1.x open the path.public Object interceptFileOpen(String path)
LegacyHooksThis is intended as a "HandleExtraFileTypesPlus".
interceptFileOpen in class LegacyHookspath - the path to the resource to open, or null if a dialog
needs to be shownnull to let ImageJ 1.x open the resource.public Object interceptOpenImage(String path, int planeIndex)
LegacyHooksThis is intended as a "HandleExtraFileTypesPlus".
interceptOpenImage in class LegacyHookspath - the path to the image to open, or null if a dialog
needs to be shownplaneIndex - If applicable - the index of plane to open or -1 for all planesnull to let ImageJ 1.x open the image.public Object interceptOpenRecent(String path)
LegacyHooksinterceptOpenRecent in class LegacyHookspath - the path to the recent image to opennull to let ImageJ 1.x open the image.public Object interceptDragAndDropFile(File f)
LegacyHooksinterceptDragAndDropFile in class LegacyHooksf - the file that was dragged onto the IJ UInull to let ImageJ 1.x open the file
as normal.public boolean interceptKeyPressed(KeyEvent e)
LegacyHooksinterceptKeyPressed in class LegacyHookse - the keyboard eventpublic Iterable<Thread> getThreadAncestors()
LegacyHooksImageJ 1.x' macro options are thread-local. Unfortunately, this does not take into account thread relationships e.g. when threads are spawned in parallel.
By overriding this method, legacy hooks can force ImageJ 1.x to look harder for macro options.
getThreadAncestors in class LegacyHookspublic boolean interceptCloseAllWindows()
LegacyHooksWindowManager.closeAllWindows().
When returning false, ImageJ 1.x will be disallowed from quitting.
interceptCloseAllWindows in class LegacyHookspublic void interceptImageWindowClose(Object window)
LegacyHooksImageWindows are fully cleaned up when
they are closed.interceptImageWindowClose in class LegacyHookspublic boolean disposing()
LegacyHooksThis method is called after it has been confirmed that quitting should proceed. That is, the user OKed all the windows being closed, etc. This method provides one final chance to cancel the quit operation by returning false; otherwise, it performs any needed disposal and cleanup.
disposing in class LegacyHookswhich is where ImageJ 1.x actually quitsCopyright © 2014–2022 ImageJ. All rights reserved.