简体   繁体   English

以编程方式获取目标平台的列表

[英]Get list of target Platform programmatically

How can I get a list of available target definitions for a workspace programmatically? 如何以编程方式获取工作区的可用目标定义列表? I am writing a plugin that requires to display the list of all available target platforms. 我正在编写一个插件,该插件需要显示所有可用目标平台的列表。

The ITargetPlatformService OSGi service provides information about the target platforms. ITargetPlatformService OSGi服务提供有关目标平台的信息。

Get this with something like: 通过类似以下方式获取此信息:

ServiceReference<ITargetPlatformService> ref = bundleContext.getService(ITargetPlatformService.class);

ITargetPlatformService service = bundleContext.getService(ref);

where bundleContext is the BundleContext passed to the start method of your plugin's activator. 其中bundleContext是传递给插件激活器的start方法的BundleContext

Call the 致电

public ITargetHandle[] getTargets(IProgressMonitor monitor)

method of ITargetPlatformService to get an array of the target platforms. ITargetPlatformService方法来获取目标平台的数组。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM