工件和元数据存储库管理器为空
我尝试加载工件和元数据存储库管理器,如下所示
private IArtifactRepositoryManager getArtifactRepositoryManager() {
IArtifactRepositoryManager artifactManager = (IArtifactRepositoryManager)
ServiceHelper.getService(ProvUIActivator.getContext(),
IArtifactRepositoryManager.class.getName());
if(artifactManager == null) {
LOG.error("ArtifactRepositoryManager service nor found");
}
return artifactManager;
}
ServiceHelper 始终返回 null。还有其他方法来获取存储库管理器吗?我正在使用 Eclipse/RCP 3.7 (Indigo)。
我之前使用过 Eclipse 3.5 中的捆绑包,并且使用此代码一切正常:
private IMetadataRepositoryManager getMetadataRepositoryManager() {
//Load repository manager
IMetadataRepositoryManager metadataManager = (IMetadataRepositoryManager) context.getService(
context.getServiceReference(IMetadataRepositoryManager.class.getName()));
return metadataManager;
}
I try to load an artifact and metadata repository manager as follows
private IArtifactRepositoryManager getArtifactRepositoryManager() {
IArtifactRepositoryManager artifactManager = (IArtifactRepositoryManager)
ServiceHelper.getService(ProvUIActivator.getContext(),
IArtifactRepositoryManager.class.getName());
if(artifactManager == null) {
LOG.error("ArtifactRepositoryManager service nor found");
}
return artifactManager;
}
ServiceHelper always returns null. Is there another way to get the repository managers? I'm using Eclipse/RCP 3.7 (Indigo).
I used bundles from Eclipse 3.5 before and everything works fine with this code:
private IMetadataRepositoryManager getMetadataRepositoryManager() {
//Load repository manager
IMetadataRepositoryManager metadataManager = (IMetadataRepositoryManager) context.getService(
context.getServiceReference(IMetadataRepositoryManager.class.getName()));
return metadataManager;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为解决方案是确保 p2 插件在您的插件启动之前启动。在您的产品配置中相应地设置自动启动级别。
I think the solution is to make sure the p2 plug-ins start before your plug-in starts. Set the auto-start levels in your product configuration accordingly.
我通过阅读“可用软件站点”首选项页面的源代码找到了解决方案。这很简单,但您找不到任何有关它的文档:
这适用于 Eclipse 3.7。对于 ProvUI 和 ProvisioningUI,您必须导入包 org.eclipse.equinox.p2.ui 和 org.eclipse.equinox.p2 .操作(等等)。
I found a solution by reading the source code of the "Available Software Sites" preference page. It's easy but you can't find any documentation about it:
This works with Eclipse 3.7. For ProvUI and ProvisioningUI you have to import bundles org.eclipse.equinox.p2.ui and org.eclipse.equinox.p2.operations (among others).