Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在eclipse RCP中找到孤立插件?_Eclipse_Eclipse Rcp_Update Site - Fatal编程技术网

如何在eclipse RCP中找到孤立插件?

如何在eclipse RCP中找到孤立插件?,eclipse,eclipse-rcp,update-site,Eclipse,Eclipse Rcp,Update Site,使用RCP更新站点禁止孤立插件,否则禁止不在功能中的插件。 如果未填写此条件,更新管理器将返回以下错误: 生成的配置不包含平台 不幸的是,没有办法确定哪些插件是孤立的。 如何找到孤立插件?这里是一个起点(这适用于Eclipse 3.4和更高版本,当引入P2存储库时,早期版本以不同的方式存储其配置。IIRC您可以在platform.xml中看到所有插件和功能) 使用“helloworld”模板创建一个新的插件项目(new->Other->plugindevelopment->pluginproje

使用RCP更新站点禁止孤立插件,否则禁止不在功能中的插件。 如果未填写此条件,更新管理器将返回以下错误: 生成的配置不包含平台

不幸的是,没有办法确定哪些插件是孤立的。 如何找到孤立插件?

这里是一个起点(这适用于Eclipse 3.4和更高版本,当引入P2存储库时,早期版本以不同的方式存储其配置。IIRC您可以在platform.xml中看到所有插件和功能)

使用“helloworld”模板创建一个新的插件项目(new->Other->plugindevelopment->pluginproject),然后将此代码放到SampleAction的run方法中

将插件作为测试Eclipse应用程序运行,然后选择Sample Menu->Sample Action,不属于某个特性的插件将输出到父工作区的控制台。当我运行这个程序时,出现了很多超出我预期的错误,我已经检查了一些,无法发现逻辑错误

Edit发现逻辑错误,在最内层循环中使用了错误的数组索引。但仍然不完全正确

编辑2。(Facepalm瞬间)发现了问题。确保在运行目标工作区时启用了所有工作区和目标插件,否则很明显,它会扭曲您的结果。如果你安装了插件,并把它修饰一下,你就不会有这个问题

//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());
        }
    }            
}
//获取属于功能的所有插件
IBundleGroupProvider[]providers=Platform.getBundleGroupProviders();
Map bundlemap=newhashmap();
如果(提供程序!=null){
for(int i=0;i
不客气,但这不是标准对话框的一部分,这让人恼火。我已经看过了,AboutFeaturesPage的代码与第一部分几乎完全相同(只是用一些信息对象将其包装起来)。在该页面中添加一个“show O孤儿”按钮是很简单的。