I want to achieve the functionality of choosing a working set programmatically. I tried with the code below:
IWorkingSetManager wsMgr = PlatformUI.getWorkbench().getWorkingSetManager();
IWorkingSet ws = wsMgr.getWorkingSet("custom");
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IWorkingSet[] windowset = new IWorkingSet[]{ws};
page.setWorkingSets(windowset);
But the code above does not work, and Project Explorer does not show the working set.
Why is the above code not working and what is the solution for the above?
To update the ProjectExplorer view with the working set, I tried the following code
IWorkingSetManager wsMgr = PlatformUI.getWorkbench().getWorkingSetManager();
IWorkingSet ws = wsMgr.getWorkingSet("custom");
ProjectExplorer pView = (ProjectExplorer) page.findView (IPageLayout.ID_PROJECT_EXPLORER); pView.getCommonViewer () setInput (WS).
The above code displays the contents of the working set in ProjectExplorer, but it is not saved. I mean, after restarting Eclipse, all projects are displayed instead of the working set.
source
share