Source:
<code>public void run() { try { IProject parentProject = this.folder.getProject(); Set<IWorkingSet> parentWorkingSets = new HashSet<IWorkingSet>(); <START> IWorkingSetManager workingSetManager = viewer.getCommonNavigator().getViewSite().getWorkbenchWindow().getWorkbench().getWorkingSetManager(); <END> for (IWorkingSet workingSet : workingSetManager.getWorkingSets()) { boolean currentWorkingSetIncludesParent = false; for (IAdaptable element : workingSet.getElements()) { if (parentProject.equals(element.getAdapter(IProject.class))) { currentWorkingSetIncludesParent = true; } if (currentWorkingSetIncludesParent) { parentWorkingSets.add(workingSet); } } } IProjectDescription desc = new ProjectDescriptionReader().read(folder.getLocation().append(IProjectDescription.DESCRIPTION_FILE_NAME)); desc.setLocation(folder.getLocation()); CreateProjectOperation operation = new CreateProjectOperation(desc, desc.getName()); IStatus status = OperationHistoryFactory.getOperationHistory().execute(operation, null, null); if (status.isOK()) { IProject newProject = (IProject) operation.getAffectedObjects()[0]; workingSetManager.addToWorkingSets(newProject, parentWorkingSets.toArray(new IWorkingSet[parentWorkingSets.size()])); viewer.setSelection(new StructuredSelection(newProject)); } else { WorkbenchNavigatorPlugin.getDefault().getLog().log(status); } } catch (IOException e) { WorkbenchNavigatorPlugin .getDefault() .getLog() .log(new Status(IStatus.ERROR, WorkbenchNavigatorPlugin.getDefault().getBundle().getSymbolicName(), "Failed to import " + folder.getName(), e)); } catch (ExecutionException e) { WorkbenchNavigatorPlugin .getDefault() .getLog() .log(new Status(IStatus.ERROR, WorkbenchNavigatorPlugin.getDefault().getBundle().getSymbolicName(), "Failed to import " + folder.getName(), e)); } }</code><technical_language>Use: PlatformUI.getWorkbench().getWorkingSetManager()</technical_language>

Target:
public void run() { try { IProject parentProject = this.folder.getProject(); Set<IWorkingSet> parentWorkingSets = new HashSet<IWorkingSet>(); IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager(); for (IWorkingSet workingSet : workingSetManager.getWorkingSets()) { for (IAdaptable element : workingSet.getElements()) { if (parentProject.equals(element.getAdapter(IProject.class))) { parentWorkingSets.add(workingSet); break; } } } IProjectDescription desc = new ProjectDescriptionReader().read(folder.getLocation().append(IProjectDescription.DESCRIPTION_FILE_NAME)); desc.setLocation(folder.getLocation()); CreateProjectOperation operation = new CreateProjectOperation(desc, desc.getName()); IStatus status = OperationHistoryFactory.getOperationHistory().execute(operation, null, null); if (status.isOK()) { IProject newProject = (IProject) operation.getAffectedObjects()[0]; workingSetManager.addToWorkingSets(newProject, parentWorkingSets.toArray(new IWorkingSet[parentWorkingSets.size()])); viewer.setSelection(new StructuredSelection(newProject)); } else { WorkbenchNavigatorPlugin.getDefault().getLog().log(status); } } catch (IOException e) { WorkbenchNavigatorPlugin .getDefault() .getLog() .log(new Status(IStatus.ERROR, WorkbenchNavigatorPlugin.getDefault().getBundle().getSymbolicName(), "Failed to import " + folder.getName(), e)); } catch (ExecutionException e) { WorkbenchNavigatorPlugin .getDefault() .getLog() .log(new Status(IStatus.ERROR, WorkbenchNavigatorPlugin.getDefault().getBundle().getSymbolicName(), "Failed to import " + folder.getName(), e)); } }