它有一个灵活的“可扩展框架”,用于管理插件我们的同类模块。最近我们做了很多重大改进,这里过去无法列举。但想记录下取得的一些进展。请注意:几天的技术性,可能只有其他 ImageJ2 开发人员感兴趣。
1.现在,通过扩展DynamicPlugin类,我们有了一种完整的工作方式来创建具有动态数量的输入和输出参数的插件。DynamicPluginTest展示了一个例子。(欢迎提供代码;在Eclipse中使用⌃ Ctrl + ⇧ Shift + T打开类型并直接动画到它。要在GUI中尝试,首先打开几个数据集,然后运行Plugins › Sandbox › Dynamic Plugin Test。这为每个输入生成一个指定大小的输出数据集。)
- 现在有一个
ModuleService来跟踪所有已知模块(插件或其他)。只要已知模块列表发生变化,它就会发布ModulesChangedEvent(添加了新模块,则为ModulesAddedEvent,如果删除了模块,则为ModulesRemovedEvent)。这与ObjectService的ObjectsUpdatedEvent类似地,因此我们将其扩展为具有相同的层次结构(Changed为基础,Added和Removed作为子类型)。 ObjectService的索引对象被分割为它自己的类,称为ObjectIndex,该类维护属于其类型层次结构的每个列表上的。例如,类型Integer的对象将注册到以下列表:Integer、Number、Object、Serializable、§§§20§§§。 4.我们实现了§§§21§§§的子类§§§22§§§,它做了同样的事情,但保留所有列表排序。然后我们将其子类为§§§23§§§,将其与§§§24§§§插件一起使用使用。因此,现在服务保留所有的索引,包括超类型层次结构,这是以前没有的。例如,您现在可以向服务询问所有§§§25§§§,并获得其中包含的§§§26§§§(子类型)。- §§§27§§§还使用名为§§§29§§§的§§§28§§§子类来维护其模块列表。
- §§§30§§§具有用于执行任何§§§31§§§或§§§32§§§的运行方法,无论是否生成新线程,以及是否有一组指定的共享器和后处理器。
- 类似地,§§§33§§§具有用于执行任何§§§34§§§或§§§35§§§及其已知的§§§36§§§和§§§37§§§的运行方法。这些方法是编程方式运行模块的主要方式。
- §§§38§§§是一种与UI无关的菜单树结构,现在每个叶子都链接到§§§39§§§。这意味着菜单边界现在能够运行脚本和其他模块,而不仅仅是插件。
下一个是:
1.动态插件实现:
- We are going to update various core plugins which need the dynamic plugin mechanism, to give it a test drive.
2.动态菜单:
- Update ShadowMenu to listen to ModulesChangedEvent and ModuleUpdatedEvent and change its internal structure accordingly. This will generally entail surgical changes to its structure rather than a full menu rebuild.
- Update the UI-toolkit-specific menu builders to keep the resultant menu structures (e.g., JMenuBar) linked to the ShadowMenu. When the ShadowMenu publishes events indicating menu items have changed, the actual UI menu needs to automatically update to reflect that as well.
- Maybe: update ModuleService to maintain a ShadowMenu data structure, which can be obtained for whatever purpose.
3.更多模块调用示例程序:
- It would be nice to have run methods of ModuleService and PluginService that accept parameters programmatically, either as a list or as a map. Grant’s InvokePluginTest shows what we are going for.