@Override
  public void switchToSolution(String id) {

    IWorkbenchPage activePage = getWorkbench().getActiveWorkbenchWindow().getActivePage();

    // store the state of the current solution
    closeSolution(session.getCurrentSolution());

    IWorkingSetManager wsManager = getWorkbench().getWorkingSetManager();
    Map<String, IWorkingSet> workingSetMap = getWorkingSetMap();

    IAggregateWorkingSet solutionSet = (IAggregateWorkingSet) workingSetMap.get(id);
    Assert.isNotNull(solutionSet, "Solution set is null: " + id);

    //		IWorkingSet[] windowSet = new IWorkingSet[]{solutionSet};
    IWorkingSet[] windowSet = solutionSet.getComponents();
    // HACK: currently the ProcjectExplorer>WorkingSetDialog does
    //	strange things with working sets, i.e., caches aggregate sets that can
    //	get invalid as these are not updated, properly
    //  workaround: delete these aggregate sets when you can :)
    String eclispeAggId = getAggregateIdForSets(windowSet);
    if (workingSetMap.containsKey(eclispeAggId)) {
      wsManager.removeWorkingSet(workingSetMap.get(eclispeAggId));
    }

    activePage.setWorkingSets(windowSet);

    openSolution(id);
    session.setCurrentSolution(id);
  }
  private void closeSolution(String slnId) {

    if (slnId == null) {
      return;
    }

    Map<String, IProject> projectMap = getProjectMap();

    SolutionEntry solutionEntry = session.getSolutions().get(session.getCurrentSolution());
    LinkedHashSet<String> openProjects = new LinkedHashSet<String>();
    Set<String> projectNames = solutionEntry.getProjectNames();
    for (String pName : projectNames) {
      if (projectMap.get(pName).isOpen()) {
        openProjects.add(pName);
      }
    }
    solutionEntry.setOpenProjects(openProjects.toArray(new String[0]));

    for (String pName : openProjects) {
      IProject p = projectMap.get(pName);
      try {
        p.close(null);
      } catch (CoreException e) {
        e.printStackTrace();
      }
    }
  }