![](/img/trans.png)
[英]Eclipse PDE : Programmatically read the contents of the target platform
[英]Get list of target Platform programmatically
如何以編程方式獲取工作區的可用目標定義列表? 我正在編寫一個插件,該插件需要顯示所有可用目標平台的列表。
ITargetPlatformService
OSGi服務提供有關目標平台的信息。
通過類似以下方式獲取此信息:
ServiceReference<ITargetPlatformService> ref = bundleContext.getService(ITargetPlatformService.class);
ITargetPlatformService service = bundleContext.getService(ref);
其中bundleContext
是傳遞給插件激活器的start
方法的BundleContext
。
致電
public ITargetHandle[] getTargets(IProgressMonitor monitor)
ITargetPlatformService
方法來獲取目標平台的數組。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.