コード例 #1
0
  public void projectOpened() {

    TaskProjectConfiguration projectConfiguration = getProjectConfiguration();

    servers:
    for (TaskProjectConfiguration.SharedServer server : projectConfiguration.servers) {
      if (server.type == null || server.url == null) {
        continue;
      }
      for (TaskRepositoryType<?> repositoryType : TaskRepositoryType.getRepositoryTypes()) {
        if (repositoryType.getName().equals(server.type)) {
          for (TaskRepository repository : myRepositories) {
            if (!repositoryType.equals(repository.getRepositoryType())) {
              continue;
            }
            if (server.url.equals(repository.getUrl())) {
              continue servers;
            }
          }
          TaskRepository repository = repositoryType.createRepository();
          repository.setUrl(server.url);
          myRepositories.add(repository);
        }
      }
    }

    myContextManager.pack(200, 50);

    // make sure the task is associated with default changelist
    LocalTask defaultTask = findTask(LocalTaskImpl.DEFAULT_TASK_ID);
    LocalChangeList defaultList = myChangeListManager.findChangeList(LocalChangeList.DEFAULT_NAME);
    if (defaultList != null && defaultTask != null) {
      ChangeListInfo listInfo = new ChangeListInfo(defaultList);
      if (!defaultTask.getChangeLists().contains(listInfo)) {
        defaultTask.addChangelist(listInfo);
      }
    }

    // remove already not existing changelists from tasks changelists
    for (LocalTask localTask : getLocalTasks()) {
      for (Iterator<ChangeListInfo> iterator = localTask.getChangeLists().iterator();
          iterator.hasNext(); ) {
        final ChangeListInfo changeListInfo = iterator.next();
        if (myChangeListManager.getChangeList(changeListInfo.id) == null) {
          iterator.remove();
        }
      }
    }

    myChangeListManager.addChangeListListener(myChangeListListener);
  }
コード例 #2
0
 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);
 }
コード例 #3
0
 private void createChangelist(final ContinuationPause context) {
   final ChangeListManager listManager = ChangeListManager.getInstance(myProject);
   String name = myTitle;
   int i = 1;
   boolean updateDefaultList = false;
   while (true) {
     final LocalChangeList changeList = listManager.findChangeList(name);
     if (changeList == null) {
       final LocalChangeList newList = listManager.addChangeList(name, null);
       listManager.setDefaultChangeList(newList);
       updateDefaultList = true;
       break;
     }
     if (changeList.getChanges().isEmpty()) {
       if (!changeList.isDefault()) {
         listManager.setDefaultChangeList(changeList);
         updateDefaultList = true;
       }
       break;
     }
     name = myTitle + " (" + i + ")";
     ++i;
   }
   if (updateDefaultList) {
     context.suspend();
     listManager.invokeAfterUpdate(
         new Runnable() {
           public void run() {
             context.ping();
           }
         },
         InvokeAfterUpdateMode.BACKGROUND_NOT_CANCELLABLE_NOT_AWT,
         "",
         ModalityState.NON_MODAL);
   }
 }