我试图在卸载插件时获取特定插件的功能名称。我可以使用下面的代码获取所需的插件名称和版本。
IRequirement iRequirement = (IRequirement) iterator.next();
String[] arr = iRequirement.toString().split("\\[|\\]|\\s+");
IVersionedId versionedId = new VersionedId(arr[0].trim(), arr[1].trim());
但是,我想在传递插件 ID 或名称时获取功能名称
最佳答案
如果您知道插件名称,例如“com.my.plugin”
,您可以使用类似的内容来获取功能名称。它存储在 Bundle
Bundle bundle = Platform.getBundle( "com.my.plugin" );
String featureName = bundle.getHeaders().get( org.osgi.framework.Constants.BUNDLE_NAME );
事实上,您还可以获得如下版本:
版本版本=bundle.getVersion();
关于java - 是否可以通过传递插件名称/ID 来获取功能标签名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43759934/