@Override
 public void trackContext(LocalChangeList changeList) {
   ChangeListInfo changeListInfo = new ChangeListInfo(changeList);
   String changeListName = changeList.getName();
   LocalTaskImpl task = createLocalTask(changeListName);
   task.addChangelist(changeListInfo);
   addTask(task);
   if (changeList.isDefault()) {
     activateTask(task, false);
   }
 }
 private void createChangeList(LocalTask task, String name, @Nullable String comment) {
   LocalChangeList changeList = myChangeListManager.findChangeList(name);
   if (changeList == null) {
     changeList = myChangeListManager.addChangeList(name, comment);
   } else {
     final LocalTask associatedTask = getAssociatedTask(changeList);
     if (associatedTask != null) {
       associatedTask.removeChangelist(new ChangeListInfo(changeList));
     }
     changeList.setComment(comment);
   }
   task.addChangelist(new ChangeListInfo(changeList));
   myChangeListManager.setDefaultChangeList(changeList);
 }
 @Nullable
 @Override
 public LocalTask getAssociatedTask(LocalChangeList list) {
   for (LocalTask task : getLocalTasks()) {
     for (ChangeListInfo changeListInfo : task.getChangeLists()) {
       if (changeListInfo.id.equals(list.getId())) {
         return task;
       }
     }
   }
   return null;
 }
  private LocalTask restoreVcsContext(LocalTask task) {
    if (!isVcsEnabled()) return task;

    List<ChangeListInfo> changeLists = task.getChangeLists();
    if (!changeLists.isEmpty()) {
      ChangeListInfo info = changeLists.get(0);
      LocalChangeList changeList = myChangeListManager.getChangeList(info.id);
      if (changeList == null) {
        changeList = myChangeListManager.addChangeList(info.name, info.comment);
        info.id = changeList.getId();
      }
      myChangeListManager.setDefaultChangeList(changeList);
    }

    List<BranchInfo> branches = task.getBranches(false);
    VcsTaskHandler.TaskInfo info = fromBranches(branches);

    VcsTaskHandler[] handlers = VcsTaskHandler.getAllHandlers(myProject);
    for (VcsTaskHandler handler : handlers) {
      handler.switchToTask(info);
    }
    return task;
  }