Eclipse在创建Plug-in项目时的Target platform选项的说明

[color=red][b]Target PlatForm[/b][/color] 插件的运行平台.

[color=darkred][b]Eclipse version[/b][/color] 指的是Eclipse UI 插件这样的运行方式.

[color=darkred][b]an OSGI framework[/b][/color] 指的是运行于OSGI下的,非UI的插件.
选项: [color=blue][b]Equinox[/b][/color] 指的是,使用Equinox(Eclipse的OSGI实现)
选项: [color=blue][b]standard[/b][/color] 指的是,使用标准的OSGI实现

[img]http://www.iteye.com/upload/attachment/69192/083c5444-2339-3918-8162-8b6e2af7e15c.jpg[/img]

下面具体说明他们的差别:
[b]
[color=red]1. 自动生成代码的区别:[/color][/b]
选择[color=darkred][b]Eclipse version[/b][/color], 那么默认生成的Activator就是继承与AbstractUIPlugin.
public class Activator extends AbstractUIPlugin {
public static final String PLUGIN_ID = "lggege.eclipse"; // The plug-in ID
private static Activator plugin; // The shared instance
public Activator() { }
/*
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
/*
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
public static Activator getDefault() {
return plugin;
}
}

[color=red]注: AbstractUIPlugin 实现了BundleActivator接口.[/color]


选择[color=blue][b]Equinox[/b][/color]或者[color=blue][b]standard[/b][/color], 那么默认的Activator就是实现了BundleActivator接口.
public class Activator implements BundleActivator {
/*
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
}
/*
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
}
}


[color=red]看出一定的区别了吧, 基于Ecliopse平台和OSGI平台(Equonix和Standard), 最终都是基于OSGI. 只是Ecliopse平台还是实现的OSGI.[/color]


[color=red][b]2. 对于IDE的区别:[/b][/color]
[color=darkred][b]Eclipse version[/b][/color],打开的MANIFEST.MF的编辑器, 它有Extensions 和 Extension Points这两个设置页面.

[color=blue][b]Equinox[/b][/color]或者[color=blue][b]standard[/b][/color],开的MANIFEST.MF的编辑器, 是没有Extensions 和 Extension Points这两个设置页面.

[color=red]
这也说明一个区别: Ecliopse平台不仅仅实现了OSGI, 同时, 还使用了自己的Plugin机制, 也就是Extensions和Extensions Points机制.

也就是Eclipse并不是一个完全的OSGI, 而是一个OSGI 与 自己的Plugin机制的结合体.
[/color]

[color=blue][b]Equinox[/b][/color]和[color=blue][b]standard[/b][/color]对于IDE没有什么区别, 也许只是提供一个功能,给你日后选择一个具体的OSGI平台留下的扩展吧.

后记:
发现Eclipse的Help里面有一些相关的信息:
[quote]Eclipse vs. OSGi Framework
The Eclipse vs. OSGi framework choice acts as pre-filter to determine what initial pages will be visible in the plug-in manifest editor when it opens.

Since the extension registry is Eclipse-specific content, the Extensions and Extension Points pages of the manifest editor are visible only when the Eclipse version option is chosen.

Equinox vs. Standard
When targeting an OSGi framework, you have a choice between the Equinox and standard frameworks. The Equinox OSGi framework augments the MANIFEST.MF content with Eclipse-specific headers (e.g. Eclipse-LazyStart) and directives (e.g. x-friends). If you do not wish to use these Eclipse-specific headers and attributes, then choose the standard option.
[/quote]

可参见:
[url]http://www.ibm.com/developerworks/cn/opensource/os-ecl-osgi/index.html[/url]

你可能感兴趣的:(RCP)