ij
Class Menus

java.lang.Object
  |
  +--ij.Menus

public class Menus
extends java.lang.Object

This class installs and updates ImageJ's menus. Note that menu labels, even in submenus, must be unique. This is because ImageJ uses a single hash table for all menu labels. If you look closely, you will see that File->Import->Text Image... and File->Save As->Text Image... do not use the same label. One of the labels has an extra space.

See Also:
ImageJ

Field Summary
static char ABOUT_MENU
           
static int COMMAND_IN_USE
           
static int COMMAND_NOT_FOUND
           
static char FILTERS_MENU
           
static char IMPORT_MENU
           
static int INVALID_SHORTCUT
           
static int NORMAL_RETURN
           
static int NOT_INSTALLED
           
static char PLUGINS_MENU
           
static char SAVE_AS_MENU
           
static int SHORTCUT_IN_USE
           
static char SHORTCUTS_MENU
           
static char TOOLS_MENU
           
static char UTILITIES_MENU
           
static int WINDOW_MENU_ITEMS
           
 
Method Summary
static boolean commandInUse(java.lang.String command)
           
static java.util.Hashtable getCommands()
          Returns the hashtable that associates commands with plugins.
static java.awt.MenuBar getMenuBar()
           
static java.lang.String[] getPlugins()
          Returns a list of the plugins in the plugins menu.
static java.lang.String getPlugInsPath()
          Returns the path to the user plugins directory.
static java.awt.PopupMenu getPopupMenu()
           
static java.util.Hashtable getShortcuts()
          Returns the hashtable that associates shortcuts with commands.
static int installPlugin(java.lang.String plugin, char menuCode, java.lang.String command, java.lang.String shortcut, ImageJ ij)
          Adds a plugin based command to the end of a specified menu.
static void savePreferences(java.util.Properties prefs)
          Called once when ImageJ quits.
static boolean shortcutInUse(java.lang.String shortcut)
           
static int uninstallPlugin(java.lang.String command)
          Deletes a command installed by installPlugin.
static void updateMenus()
          Updates the Image/Type and Window menus.
static void updateWindowMenuItem(java.lang.String oldLabel, java.lang.String newLabel)
          Changes the name of an item in the Window menu.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PLUGINS_MENU

public static final char PLUGINS_MENU

IMPORT_MENU

public static final char IMPORT_MENU

SAVE_AS_MENU

public static final char SAVE_AS_MENU

SHORTCUTS_MENU

public static final char SHORTCUTS_MENU

ABOUT_MENU

public static final char ABOUT_MENU

FILTERS_MENU

public static final char FILTERS_MENU

TOOLS_MENU

public static final char TOOLS_MENU

UTILITIES_MENU

public static final char UTILITIES_MENU

WINDOW_MENU_ITEMS

public static final int WINDOW_MENU_ITEMS

NORMAL_RETURN

public static final int NORMAL_RETURN

COMMAND_IN_USE

public static final int COMMAND_IN_USE

INVALID_SHORTCUT

public static final int INVALID_SHORTCUT

SHORTCUT_IN_USE

public static final int SHORTCUT_IN_USE

NOT_INSTALLED

public static final int NOT_INSTALLED

COMMAND_NOT_FOUND

public static final int COMMAND_NOT_FOUND
Method Detail

getPlugins

public static java.lang.String[] getPlugins()
Returns a list of the plugins in the plugins menu.

getMenuBar

public static java.awt.MenuBar getMenuBar()

updateMenus

public static void updateMenus()
Updates the Image/Type and Window menus.

getPlugInsPath

public static java.lang.String getPlugInsPath()
Returns the path to the user plugins directory. Returns null if there is no plugins directory.

getCommands

public static java.util.Hashtable getCommands()
Returns the hashtable that associates commands with plugins.

getShortcuts

public static java.util.Hashtable getShortcuts()
Returns the hashtable that associates shortcuts with commands. The keys in the hashtable are Integer keycodes, or keycode+200 for uppercase.

updateWindowMenuItem

public static void updateWindowMenuItem(java.lang.String oldLabel,
                                        java.lang.String newLabel)
Changes the name of an item in the Window menu.

getPopupMenu

public static java.awt.PopupMenu getPopupMenu()

installPlugin

public static int installPlugin(java.lang.String plugin,
                                char menuCode,
                                java.lang.String command,
                                java.lang.String shortcut,
                                ImageJ ij)
Adds a plugin based command to the end of a specified menu.
Parameters:
plugin - the plugin (e.g. "Inverter_", "Inverter_("arg")")
menuCode - PLUGINS_MENU, IMPORT_MENU, SAVE_AS_MENU or HOT_KEYS
command - the menu item label (set to "" to uninstall)
command - the keyboard shortcut (e.g. "y", "Y", "F1")
ij - ImageJ (the action listener)
Returns:
returns an error code(NORMAL_RETURN,COMMAND_IN_USE_ERROR, etc.)

uninstallPlugin

public static int uninstallPlugin(java.lang.String command)
Deletes a command installed by installPlugin.

commandInUse

public static boolean commandInUse(java.lang.String command)

shortcutInUse

public static boolean shortcutInUse(java.lang.String shortcut)

savePreferences

public static void savePreferences(java.util.Properties prefs)
Called once when ImageJ quits.