@@ -0,0 +1,1590 @@
+package imagej2.ij1bridge.plugin;%0A%0Aimport ij.IJ;%0Aimport ij.ImageJ;%0Aimport ij.Menus;%0Aimport imagej2.plugin.PluginEntry;%0Aimport imagej2.plugin.PluginFinder;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.Hashtable;%0Aimport java.util.List;%0A%0Aimport org.openide.util.lookup.ServiceProvider;%0A%0A@ServiceProvider(service=PluginFinder.class)%0Apublic class Ij1PluginFinder implements PluginFinder %7B%0A%0A%09@Override%0A%09public void findPlugins(List%3CPluginEntry%3E plugins) %7B%0A%09%09if (IJ.getInstance() == null) %7B%0A%09%09%09// TODO -- use NO_SHOW mode (requires ImageJ 1.44)%0A%09%09%09new ImageJ();%0A%09%09%09IJ.getInstance().setVisible(false);%0A%09%09%7D%0A%09%09final Hashtable%3C?, ?%3E commands = Menus.getCommands();%0A%09%09for (final Object key : commands.keySet()) %7B%0A%09%09%09final String pluginClass = commands.get(key).toString();%0A%09%09%09final List%3CString%3E parentMenu = new ArrayList%3CString%3E();%0A%09%09%09// TODO -- populate with actual menu location%0A%09%09%09parentMenu.add(%22Plugins%22);%0A%09%09%09final String label = key.toString();%0A%09%09%09final PluginEntry pluginEntry = new PluginEntry(pluginClass, parentMenu, label);%0A%09%09%09plugins.add(pluginEntry);%0A%09%09%7D%0A%09%7D%0A%0A%09/**%0A%09 * Tests the IJ1 plugin discovery mechanism,%0A%09 * printing a list of all discovered plugins.%0A%09 */%0A%09public static void main(String%5B%5D args) %7B%0A%09%09System.setProperty(%22plugins.dir%22, %22/Applications/Science/ImageJ/plugins%22);//TEMP%0A%09%09System.out.println(%22Finding plugins...%22);%0A%09%09List%3CPluginEntry%3E plugins = new ArrayList%3CPluginEntry%3E();%0A%09%09new Ij1PluginFinder().findPlugins(plugins);%0A%09%09System.out.println(%22Discovered plugins:%22);%0A%09%09for (PluginEntry plugin : plugins) %7B%0A%09%09%09System.out.println(%22%5Ct%22 + plugin);%0A%09%09%7D%0A%09%09System.exit(0);%0A%09%7D%0A%0A%7D%0A

Add (overly) simple IJ1 discovery code, using ij.Menus.