如何在插件中获取工作区的工作集信息? [英] How to get a Workspace's working sets information in a plugin?
问题描述
我想获取当前工作空间的运行时工作集信息.我尝试了以下方法:IWorkbenchPage的IWorkingSet [] getWorkingSets()
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
if (page != null) { IWorkingSet[] sets = page.getWorkingSets();}
但是当我调试代码时,该方法什么也不返回.
我想知道我是否使用正确的方法来获取工作区的工作集信息?如果没有,如何获取数据?
IWorkbenchPage
getWorkingSets()
方法返回该页面使用的窗口工作集"-默认情况下未启用此选项,因此返回null. /p>
如果要在工作台中定义所有工作集,请使用:
IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager();
IWorkingSet [] allSets = manager.getAllWorkingSets();
工作集管理器还有许多其他处理工作集的方法.
I want to get the runtime working sets information of the current workspace. I have tried the method: IWorkingSet[] getWorkingSets() of the IWorkbenchPage
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
if (page != null) { IWorkingSet[] sets = page.getWorkingSets();}
but when I debug the code, the method returns nothing.
I am wondering am I use the right method to get a workspace's working sets information? If not, how to get the data?
The IWorkbenchPage
getWorkingSets()
method returns the 'Window Working Sets' in use for the page - this option is not enabled by default so returns null.
If you want all the working sets defined in the workbench you use:
IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager();
IWorkingSet [] allSets = manager.getAllWorkingSets();
The working set manager has many other methods for handling working sets.
这篇关于如何在插件中获取工作区的工作集信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!