Source:
public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbench workbench = PlatformUI.getWorkbench(); this.shell = workbench.getActiveWorkbenchWindow().getShell(); DirectoryDialog directoryDialog = new DirectoryDialog(shell); directoryDialog.setText(DataTransferMessages.SmartImportWizardPage_selectFolderOrArchiveToImport); IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); directoryDialog.setFilterPath(workspaceRoot.getLocation().toFile().toString()); ISelection sel = workbench.getActiveWorkbenchWindow().getSelectionService().getSelection(); IStructuredSelection structuredSel = null; if (sel != null && sel instanceof IStructuredSelection) { structuredSel = (IStructuredSelection)sel; if (!structuredSel.isEmpty()) { File selectedFile = SmartImportWizard.toFile(structuredSel.getFirstElement()); if (selectedFile != null) { directoryDialog.setFilterPath(selectedFile.getAbsolutePath()); } } } String res = directoryDialog.open(); if (res == null) { return null; } SmartImportWizard wizard = new SmartImportWizard(); final File directory = new File(res); wizard.setInitialImportSource(directory); final Path asPath = new Path(directory.getAbsolutePath()); IProject parentProject = null; for (IProject project : workspaceRoot.getProjects()) { if (project.getLocation().isPrefixOf(asPath) && (parentProject == null || parentProject.getLocation().isPrefixOf(project.getLocation())) ) { parentProject = project; } } Set<IWorkingSet> initialWorkingSets = new HashSet<>(); if (parentProject != null) { for (IWorkingSet workingSet : workbench.getWorkingSetManager().getAllWorkingSets()) { for (IAdaptable element : workingSet.getElements()) { if (element.equals(parentProject)) { initialWorkingSets.add(workingSet); } } } } if (initialWorkingSets.isEmpty()) { wizard.init(workbench, structuredSel); } else { wizard.setInitialWorkingSets(initialWorkingSets); } return new WizardDialog(workbench.getActiveWorkbenchWindow().getShell(), wizard).open(); }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbench workbench = PlatformUI.getWorkbench(); this.shell = workbench.getActiveWorkbenchWindow().getShell(); DirectoryDialog directoryDialog = new DirectoryDialog(shell); directoryDialog.setText(DataTransferMessages.SmartImportWizardPage_selectFolderOrArchiveToImport); IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); directoryDialog.setFilterPath(workspaceRoot.getLocation().toFile().toString()); ISelection sel = workbench.getActiveWorkbenchWindow().getSelectionService().getSelection(); IStructuredSelection structuredSel = null; if (sel != null && sel instanceof IStructuredSelection) { structuredSel = (IStructuredSelection)sel; if (!structuredSel.isEmpty()) { File selectedFile = SmartImportWizard.toFile(structuredSel.getFirstElement()); if (selectedFile != null) { directoryDialog.setFilterPath(selectedFile.getAbsolutePath()); } } } String res = directoryDialog.open(); if (res == null) { return null; } SmartImportWizard wizard = new SmartImportWizard(); final File directory = new File(res); wizard.setInitialImportSource(directory); final Path asPath = new Path(directory.getAbsolutePath()); IProject parentProject = null; for (IProject project : workspaceRoot.getProjects()) { if (project.getLocation().isPrefixOf(asPath) && (parentProject == null || parentProject.getLocation().isPrefixOf(project.getLocation())) ) { parentProject = project; } } Set<IWorkingSet> initialWorkingSets = new HashSet<>(); if (parentProject != null) { for (IWorkingSet workingSet : workbench.getWorkingSetManager().getAllWorkingSets()) { for (IAdaptable element : workingSet.getElements()) { if (element.equals(parentProject)) { initialWorkingSets.add(workingSet); } } } } if (initialWorkingSets.isEmpty()) { wizard.init(workbench, structuredSel); } else { wizard.setInitialWorkingSets(initialWorkingSets); } new WizardDialog(workbench.getActiveWorkbenchWindow().getShell(), wizard).open(); return null; }