gpt4 book ai didi

java - Eclipse 中的插件间通信

转载 作者:搜寻专家 更新时间:2023-11-01 03:45:40 24 4
gpt4 key购买 nike

是否可以创建自动发现彼此的 Eclipse 插件?

我正在开发一组需要在两种主要情况下运行的插件:

  • 个人
  • 彼此一致。

当单独运行时,插件应该“正常工作”,但当协同运行时,它们将共享一些相同的模型内容,并且其中一个插件应该向用户显示其他插件的列表以与之共享内容。例如:

Foo Plugin detected the following plugins it can share ontologies with:

[ ] Bar plugin

[ ] Baz plugin

[ ] Don't share

Eclipse 是否提供任何内部发布/检测方法来促进对其他插件的这种自动检测?

最佳答案

答案应该是通过Declarative Service ,它结合了 eclipse xml 扩展和 osgi POJO 服务的优点。像 osgi 服务一样隐式动态,但像 eclipse 扩展一样“按需”加载的东西。

2006 年针对 eclipse3.3 引入,您将在 this presentation 中找到这些概念的说明。 .

Declarative Services gives the option to define reference to other services. It is also possible to specify the cardinality of the reference. The cardinality is specified using two numbers, the first one, 0 or 1, indicates the optionality, the second one, 1 or n, indicates the multiplicity.

在实践中,那些DS (Declarative Services)不容易使用,因为您必须访问 BundleContext,这意味着跟踪 BundleActivator,which is not always easy ...

如果您需要定义某种面向服务的组件模型,this presentation应该为您提供当今存在的不同替代方案,并详细说明这些“声明式服务”


发布 rcreswick 发现的与 DS 相关的内容:

关于java - Eclipse 中的插件间通信,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/213349/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com