Eclipse 扩展和声明式服务

2022-01-16 00:00:00 plugins eclipse-plugin java eclipse osgi

我对 Eclipse 架构中的扩展/服务方法有点困惑.开发人员有两种选择:

I'm a little confused on the approach to extensions/services in the Eclipse architecture. There are two options available to a developer:

  1. Eclipse插件扩展的使用——http://www.eclipse.org/articles/Article-插件架构/plugin_architecture.html
  2. 声明式服务的使用 - http://www.eclipse.org/equinox/bundles/

什么时候你会使用其中一种,有什么优点和缺点每种方法?未来哪个是首选方法?

When you would use one over the other and what are the advantages and the disadvantages of each approach? Also going forward which is the preferred approach?

推荐答案

在 EclipseZone 上有一个很好的比较(我认为是从 2007 年开始):Eclipse 扩展和 OSGi 服务的比较.

There's a pretty good comparison (from 2007, I think) on EclipseZone: A Comparison of Eclipse Extensions and OSGi Services.

我会遵循您的目标平台的约定.因此,如果您正在为 Eclipse 3.4 编写插件,比如说,创建一个 Eclipse 3.4 插件(它将使用 MANIFEST.MF 来表示依赖项,使用 plugin.xml 表示扩展/扩展点 - 您链接到的文章是针对 Eclipse 2.x 的).您可以检查 plugins 目录的内容来确认这一点.

I would follow the conventions of your target platform. So, if you're writing a plugin for Eclipse 3.4, say, create an Eclipse 3.4 plugin (which will use a MANIFEST.MF for dependencies and a plugin.xml for extensions/extension points - the article you link to is for Eclipse 2.x). You can examine the contents of the plugins directory to confirm this.

相关文章