![](/img/trans.png)
[英]Eclipse keyboard shortcut for rename/refactor is unbinded in 2022-03
[英]How to get the eclipse platform version in "2022-03" programmatically
我需要以编程方式获取2022-03
格式的 Eclipse 版本。
我正在尝试使用Platform.getBundle("org.eclipse.platform").getVersion()
但它以4.23.0.v20220308-0310
格式提供版本。
请问有人能给点建议吗?
在此先感谢您的时间。
2022-03是整个产品package的名称,而不是Eclipse Platform,它只是一个组件。 4.23 是平台的正确版本。
据我所知,2022-03 名称仅出现在产品“定义包”中的about.mappings
文件中,并且仅用于“关于”文本中。
about.mappings 看起来像
# about.mappings
# contains fill-ins for about.properties
# java.io.Properties file (ISO 8859-1 with "\" escapes)
# This file does not need to be translated.
0=I20220817-1800
1=2022-09
2=4.25
您可以使用以下方法阅读此内容:
IProduct product = Platform.getProduct();
Bundle bundle = product.getDefiningBundle();
URL location = FileLocator.find(bundle, new Path("about.mappings"));
try (InputStream is = location.openStream())
{
ResourceBundle res = new PropertyResourceBundle(is);
String version = res.getString("1");
}
catch (final IOException ex)
{
...
}
这是基于org.eclipse.ui.internal.ProductProperties
中的代码
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.