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();
  }
Пример #3
0
  private DarkBotMCSpambot(MinecraftBotData data, String owner)
      throws AuthenticationException, UnsupportedProtocolException {
    super(data);
    synchronized (bots) {
      bots.add(this);
    }
    addOwner(owner);
    addBackend(new ChatBackend(this));

    TaskManager taskManager = bot.getTaskManager();
    taskManager.registerTask(new FallTask(bot));
    taskManager.registerTask(new FollowTask(bot));
    taskManager.registerTask(new DefendTask(bot));
    taskManager.registerTask(new AttackTask(bot));
    taskManager.registerTask(new HostileTask(bot));
    taskManager.registerTask(new EatTask(bot));

    commandManager.register(new AttackAllCommand(this));
    commandManager.register(new AttackCommand(this));
    commandManager.register(new CalcCommand(this));
    commandManager.register(new ChatDelayCommand(this));
    commandManager.register(new DropAllCommand(this));
    commandManager.register(new DropCommand(this));
    commandManager.register(new DropIdCommand(this));
    commandManager.register(new EquipCommand(this));
    commandManager.register(new FollowCommand(this));
    commandManager.register(new InteractCommand(this));
    commandManager.register(new OwnerCommand(this));
    commandManager.register(new QuitCommand(this));
    commandManager.register(new SayCommand(this));
    commandManager.register(new SetWalkCommand(this));
    commandManager.register(new SpamCommand(this));
    commandManager.register(new StatusCommand(this));
    commandManager.register(new StopCommand(this));
    commandManager.register(new SwitchCommand(this));
    commandManager.register(new ToolCommand(this));
    commandManager.register(new WalkCommand(this));

    connectionHandler = bot.getConnectionHandler();
    Session session = bot.getSession();
    System.out.println("[" + session.getUsername() + "] Done! (" + bots.size() + ")");
  }
  @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));
  }