Source:
<code>public static Workspace getWorkspace() throws Exception { if (getInstance() == null) { throw new IllegalStateException("Central is not initialised"); } Workspace ws; boolean resolve; synchronized (workspaceQueue) { ws = workspace; File workspaceDirectory = getWorkspaceDirectory(); if (ws != null) { if (workspaceDirectory != null && ws.isDefaultWorkspace()) { ws.setFileSystem(workspaceDirectory, Workspace.CNFDIR); ws.refresh(); resolve = !workspaceQueue.getPromise() .isDone(); } else if (workspaceDirectory == null && !ws.isDefaultWorkspace()) { ws.setFileSystem(Workspace.BND_DEFAULT_WS, Workspace.CNFDIR); ws.refresh(); resolve = false; } else { resolve = false; } } else { try { Workspace.setDriver(Constants.BNDDRIVER_ECLIPSE); Workspace.addGestalt(Constants.GESTALT_INTERACTIVE, new Attrs()); if (workspaceDirectory == null) { ws = Workspace.createDefaultWorkspace(); } else { ws = Workspace.getWorkspace(workspaceDirectory); } resolve = !workspaceQueue.getPromise() .isDone(); ws.setOffline(new BndPreferences().isWorkspaceOffline()); ws.addBasicPlugin(new SWTClipboard()); ws.addBasicPlugin(new WorkspaceListener(ws)); ws.addBasicPlugin(getInstance().repoListenerTracker); ws.addBasicPlugin(getEclipseWorkspaceRepository()); ws.addBasicPlugin(new JobProgress()); ws.getBuildOrder(); addCnfChangeListener(ws); workspaceRepositoryChangeDetector = new WorkspaceRepositoryChangeDetector(ws); workspace = ws; } catch (final Exception e) { if (ws != null) { ws.close(); } logger.logError("Init of workspace", e); throw e; } } <START> getInstance().repoPluginTracker.open(ws); <END> } if (resolve) workspaceQueue.resolve(ws); return ws; }</code><technical_language>I moved this a callback</technical_language>

Target:
public static Workspace getWorkspace() throws Exception { if (getInstance() == null) { throw new IllegalStateException("Central is not initialised"); } Workspace ws; boolean resolve; synchronized (workspaceQueue) { ws = workspace; File workspaceDirectory = getWorkspaceDirectory(); if (ws != null) { if (workspaceDirectory != null && ws.isDefaultWorkspace()) { ws.setFileSystem(workspaceDirectory, Workspace.CNFDIR); ws.refresh(); resolve = !workspaceQueue.getPromise() .isDone(); } else if (workspaceDirectory == null && !ws.isDefaultWorkspace()) { ws.setFileSystem(Workspace.BND_DEFAULT_WS, Workspace.CNFDIR); ws.refresh(); resolve = false; } else { resolve = false; } } else { try { Workspace.setDriver(Constants.BNDDRIVER_ECLIPSE); Workspace.addGestalt(Constants.GESTALT_INTERACTIVE, new Attrs()); if (workspaceDirectory == null) { ws = Workspace.createDefaultWorkspace(); resolve = false; } else { ws = Workspace.getWorkspace(workspaceDirectory); resolve = true; } ws.setOffline(new BndPreferences().isWorkspaceOffline()); ws.addBasicPlugin(new SWTClipboard()); ws.addBasicPlugin(new WorkspaceListener(ws)); ws.addBasicPlugin(getInstance().repoListenerTracker); ws.addBasicPlugin(getEclipseWorkspaceRepository()); ws.addBasicPlugin(new JobProgress()); ws.getBuildOrder(); addCnfChangeListener(ws); workspaceRepositoryChangeDetector = new WorkspaceRepositoryChangeDetector(ws); workspace = ws; } catch (final Exception e) { if (ws != null) { ws.close(); } logger.logError("Init of workspace", e); throw e; } } } if (resolve) workspaceQueue.resolve(ws); return ws; }