Source:
public boolean performFinish() { boolean result = false; if (mainPage.isPageComplete()) { final File rootImportPath = mainPage.getSelectedFolder(); final WorkspaceModifyOperation op = new WorkspaceModifyOperation() { @Override protected void execute(IProgressMonitor monitor) throws CoreException { try { importProjects(rootImportPath, monitor); } catch (Exception e) { throw new CoreException(new Status(IStatus.ERROR, Plugin.PLUGIN_ID, "Error during import of Bnd workspace!", e)); } } }; Job importJob = new Job("Import Bnd Workspace") { @Override protected IStatus run(IProgressMonitor monitor) { try { op.run(monitor); } catch (InvocationTargetException e) { Throwable t = e.getCause(); if (t instanceof CoreException && ((CoreException) t).getStatus().getException() != null) { t = ((CoreException) t).getStatus().getException(); } return new Status(Status.ERROR, Plugin.PLUGIN_ID, "Could not finish import job for Bnd Workspace!", t); } catch (InterruptedException e) { return Status.CANCEL_STATUS; } return Status.OK_STATUS; } }; importJob.schedule(); try { IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); IPerspectiveDescriptor currentPerspective = window.getActivePage().getPerspective(); if (!"bndtools.perspective".equals(currentPerspective.getId())) { if (MessageDialog.openQuestion(getShell(), "Bndtools Perspective", "Switch to the Bndtools perspective?")) { this.workbench.showPerspective("bndtools.perspective", window); } } } catch (WorkbenchException e) { error("Unable to switch to BndTools perspective", e); } result = true; } return result; }

Target:
public boolean performFinish() { final ImportSettings importSettings = new ImportSettings(mainPage.getSelectedFolder(), mainPage.isDeleteSettings(), mainPage.isInferExecutionEnvironment()); final WorkspaceModifyOperation op = new WorkspaceModifyOperation() { @Override protected void execute(IProgressMonitor monitor) throws CoreException { try { importProjects(importSettings, monitor); } catch (Exception e) { throw new CoreException(new Status(IStatus.ERROR, Plugin.PLUGIN_ID, "Error during import of Bnd workspace!", e)); } } }; Job importJob = new Job("Import Bnd Workspace") { @Override protected IStatus run(IProgressMonitor monitor) { try { op.run(monitor); } catch (InvocationTargetException e) { Throwable t = e.getCause(); if (t instanceof CoreException && ((CoreException) t).getStatus().getException() != null) { t = ((CoreException) t).getStatus().getException(); } return new Status(Status.ERROR, Plugin.PLUGIN_ID, "Could not finish import job for Bnd Workspace!", t); } catch (InterruptedException e) { return Status.CANCEL_STATUS; } return Status.OK_STATUS; } }; importJob.schedule(); try { IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); IPerspectiveDescriptor currentPerspective = window.getActivePage().getPerspective(); if (!"bndtools.perspective".equals(currentPerspective.getId())) { if (MessageDialog.openQuestion(getShell(), "Bndtools Perspective", "Switch to the Bndtools perspective?")) { this.workbench.showPerspective("bndtools.perspective", window); } } } catch (WorkbenchException e) { error("Unable to switch to BndTools perspective", e); } return true; }