In a custom ImageJ plugin, before IJ.run(imp, myCommand, myArguments)
I would like to check if myCommand
exists and if not - try another command.
There doesn't seem to be a method for this purpose in the IJ class . What are the alternatives to try {} catch
?
Some alternatives:
Write an ImageJ2 plugin so your command will be automatically exposed in the framework, eg in the CommandService . This would also allow you to use prioritization of plugins, which it sounds is potentially what you're looking for.
You could use Menus.getCommands() : if (Menus.getCommands().get(command) != null) IJ.run(command);
Try...catch
a Class.forName
call
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.