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
 public void update(AnActionEvent event) {
   super.update(event);
   if (event.getPresentation().isEnabled()) {
     Presentation presentation = event.getPresentation();
     String url = getIssueUrl(event);
     presentation.setEnabled(url != null);
     Project project = getProject(event);
     if (project == null || !TaskManager.getManager(project).getActiveTask().isIssue()) {
       presentation.setText(getTemplatePresentation().getText());
     } else {
       presentation.setText(
           "Open '"
               + TaskManager.getManager(project).getActiveTask().getPresentableName()
               + "' In _Browser");
     }
   }
 }
  @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();
  }
 @Nullable
 private static String getIssueUrl(AnActionEvent event) {
   Project project = CommonDataKeys.PROJECT.getData(event.getDataContext());
   return project == null ? null : TaskManager.getManager(project).getActiveTask().getIssueUrl();
 }
  @Override
  public void setUp() throws Exception {
    super.setUp();

    myVcs = new MockAbstractVcs(getProject());
    AllVcses.getInstance(getProject()).registerManually(myVcs);
    myChangeListManager = (ChangeListManagerImpl) ChangeListManager.getInstance(getProject());

    myTaskManager = (TaskManagerImpl) TaskManager.getManager(getProject());

    ProjectLevelVcsManager.getInstance(getProject()).setDirectoryMapping("", myVcs.getName());
    ProjectLevelVcsManager.getInstance(getProject()).hasActiveVcss();
    myRepository = new TestRepository();
    myRepository.setTasks(
        new Task() {
          @NotNull
          @Override
          public String getId() {
            return "TEST-001";
          }

          @NotNull
          @Override
          public String getSummary() {
            return "Summary";
          }

          @Override
          public String getDescription() {
            return null;
          }

          @NotNull
          @Override
          public Comment[] getComments() {
            return new Comment[0];
          }

          @NotNull
          @Override
          public Icon getIcon() {
            return TasksIcons.Unknown;
          }

          @NotNull
          @Override
          public TaskType getType() {
            return TaskType.BUG;
          }

          @Override
          public Date getUpdated() {
            return null;
          }

          @Override
          public Date getCreated() {
            return null;
          }

          @Override
          public boolean isClosed() {
            return false;
          }

          @Override
          public boolean isIssue() {
            return true;
          }

          @Override
          public String getIssueUrl() {
            return null;
          }

          @Override
          public TaskRepository getRepository() {
            return myRepository;
          }
        });
    myTaskManager.setRepositories(Collections.singletonList(myRepository));
  }