使用RCP更新网站禁止孤立插件,否则插件不在功能中。如果未满足此条件,更新管理器将返回以下错误:生成的配置不包含平台。
不幸的是,没有办法确定哪些插件是孤立的。如何找到孤立插件?
发布于 2009-07-29 15:33:22
这里是一个起点(这适用于Eclipse3.4和更高版本,当引入P2存储库时,早期版本以不同的方式存储它们的配置。你可以看到platform.xml中的所有插件和特性)。
使用"Hello World“模板创建一个新的插件项目( new ->Other->Plug-in Development->Plug-in Project),然后将此代码放入SampleAction的run方法中。
将插件作为测试Eclipse应用程序运行,并选择Sample Menu->Sample Action,不属于某个特性的插件将输出到父工作区的控制台。当我运行这个的时候,有很多比我预期的要多的,我已经看了几遍,但是找不到逻辑错误。
编辑,发现逻辑错误,在最里面的循环中使用了错误的数组索引。但仍然不是很正确。
编辑2. (Facepalm moment)找到了问题。确保在运行目标工作区时启用了所有工作区和已启用的目标插件,否则很明显会影响结果。如果你安装这个插件并稍微修饰一下,你就不会有这个问题了。
//get all the plugins that belong to features
IBundleGroupProvider[] providers = Platform.getBundleGroupProviders();
Map<Long, IBundleGroup> bundlesMap = new HashMap<Long, IBundleGroup>();
if (providers != null) {
for (int i = 0; i < providers.length; i++) {
IBundleGroup[] bundleGroups = providers[i].getBundleGroups();
System.out.println("Bundle groups:");
for (int j = 0; j < bundleGroups.length; j++) {
Bundle[] bundles = bundleGroups[j] == null ? new Bundle[0] : bundleGroups[j]
.getBundles();
System.out.println(bundleGroups[j].getIdentifier());
for (int k = 0; k < bundles.length; k++) {
bundlesMap.put(bundles[k].getBundleId(), bundleGroups[j]);
}
}
}
}
BundleContext bundleContext = Activator.getDefault().getBundle().getBundleContext();
if(bundleContext instanceof BundleContextImpl) {
Bundle[] bundles = ((BundleContextImpl)bundleContext).getBundles();
System.out.println("Orphan Bundles:");
for (int i = 0; i < bundles.length; i++) {
if(!bundlesMap.containsKey(bundles[i].getBundleId())) {
System.out.println(bundles[i].getSymbolicName());
}
}
}https://stackoverflow.com/questions/1200202
复制相似问题