@Override
  public @NotNull Consumer<@NotNull LocalChangeList> addControls(@NotNull JPanel bottomPanel, @Nullable LocalChangeList initial) {
    TaskManagerImpl taskManager = (TaskManagerImpl)TaskManager.getManager(project);

    JCheckBox checkBox = new JCheckBox(TaskBundle.message("switch.changelist.track.context.checkbox"));
    checkBox.setToolTipText(TaskBundle.message("switch.changelist.track.context.checkbox.tooltip"));
    checkBox.setSelected(initial == null ?
                         taskManager.getState().trackContextForNewChangelist :
                         taskManager.getAssociatedTask(initial) != null);
    bottomPanel.add(checkBox);
    return changeList -> {
      if (initial == null) {
        taskManager.getState().trackContextForNewChangelist = checkBox.isSelected();
        if (checkBox.isSelected()) {
          taskManager.trackContext(changeList);
        }
        else {
          taskManager.getActiveTask().addChangelist(new ChangeListInfo(changeList));
        }
      }
      else {
        final LocalTask associatedTask = taskManager.getAssociatedTask(changeList);
        if (checkBox.isSelected()) {
          if (associatedTask == null) {
            taskManager.trackContext(changeList);
          }
        }
        else {
          if (associatedTask != null) {
            taskManager.removeTask(associatedTask);
          }
        }
      }
    };
  }
@Override
  public @NotNull Consumer<@NotNull LocalChangeList> addControls(@NotNull JPanel bottomPanel, @Nullable LocalChangeList initial)