protected TaskRepository(TaskRepository other) {
   myType = other.myType;
   myShared = other.isShared();
   myUrl = other.getUrl();
   setShouldFormatCommitMessage(other.myShouldFormatCommitMessage);
   setCommitMessageFormat(other.myCommitMessageFormat);
 }
  public SimpleOpenTaskDialog(@NotNull final Project project, @NotNull final Task task) {
    super(project, false);
    myProject = project;
    myTask = task;
    TaskManagerImpl taskManager = (TaskManagerImpl) TaskManager.getManager(myProject);
    setTitle("Open Task");
    myTaskNameLabel.setText(TaskUtil.getTrimmedSummary(task));

    TaskManagerImpl manager = (TaskManagerImpl) TaskManager.getManager(project);
    ControlBinder binder = new ControlBinder(manager.getState());
    binder.bindAnnotations(this);
    binder.reset();

    TaskRepository repository = task.getRepository();
    if (repository == null
        || !repository
            .getRepositoryType()
            .getPossibleTaskStates()
            .contains(TaskState.IN_PROGRESS)) {
      myMarkAsInProgressBox.setVisible(false);
    }

    myClearContext.setSelected(taskManager.getState().clearContext);

    if (!manager.isVcsEnabled()) {
      myCreateChangelist.setEnabled(false);
      myCreateChangelist.setSelected(false);
    } else {
      myCreateChangelist.setSelected(taskManager.getState().createChangelist);
      myCreateChangelist.setEnabled(true);
    }
    init();
    getPreferredFocusedComponent();
  }
  @Override
  protected void doOKAction() {
    TaskManagerImpl taskManager = (TaskManagerImpl) TaskManager.getManager(myProject);

    taskManager.getState().markAsInProgress = isMarkAsInProgress();
    if (taskManager.isVcsEnabled()) {
      taskManager.getState().createChangelist = myCreateChangelist.isSelected();
    }

    TaskRepository repository = myTask.getRepository();
    if (isMarkAsInProgress() && repository != null) {
      try {
        repository.setTaskState(myTask, TaskState.IN_PROGRESS);
      } catch (Exception ex) {
        Messages.showErrorDialog(myProject, "Could not set state for " + myTask.getId(), "Error");
        LOG.warn(ex);
      }
    }
    taskManager.activateTask(myTask, isClearContext(), isCreateChangelist());
    if (myTask.getType() == TaskType.EXCEPTION && AnalyzeTaskStacktraceAction.hasTexts(myTask)) {
      AnalyzeTaskStacktraceAction.analyzeStacktrace(myTask, myProject);
    }
    super.doOKAction();
  }
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (!(o instanceof TaskRepository)) return false;

    TaskRepository that = (TaskRepository) o;
    if (!Comparing.equal(myType, that.myType)) return false;
    if (isShared() != that.isShared()) return false;
    if (getUrl() != null ? !getUrl().equals(that.getUrl()) : that.getUrl() != null) return false;
    if (getCommitMessageFormat() != null
        ? !getCommitMessageFormat().equals(that.getCommitMessageFormat())
        : that.getCommitMessageFormat() != null) {
      return false;
    }
    return isShouldFormatCommitMessage() == that.isShouldFormatCommitMessage();
  }