Search in sources :

Example 11 with LocalTaskImpl

use of com.intellij.tasks.impl.LocalTaskImpl in project intellij-community by JetBrains.

the class TaskBranchesTest method testCleanupRemovedBranch.

public void testCleanupRemovedBranch() throws InterruptedException {
    Repository repository = initRepository("foo");
    LocalTask defaultTask = myTaskManager.getActiveTask();
    assertNotNull(defaultTask);
    assertEquals(0, defaultTask.getBranches().size());
    LocalTaskImpl foo = myTaskManager.createLocalTask("foo");
    LocalTask localTask = myTaskManager.activateTask(foo, false);
    myTaskManager.createBranch(localTask, defaultTask, myTaskManager.suggestBranchName(localTask), null);
    assertEquals(2, localTask.getBranches().size());
    assertEquals(1, defaultTask.getBranches().size());
    // let's add non-existing branch
    BranchInfo info = new BranchInfo();
    info.name = "non-existing";
    info.repository = defaultTask.getBranches().get(0).repository;
    defaultTask.addBranch(info);
    repository.update();
    assertEquals("foo", repository.getCurrentBranchName());
    myTaskManager.activateTask(defaultTask, false);
    repository.update();
    assertEquals(getDefaultBranchName(), repository.getCurrentBranchName());
    // do not re-create "non-existing"
    assertEquals(2, getNumberOfBranches(repository));
}
Also used : Repository(com.intellij.dvcs.repo.Repository) LocalTaskImpl(com.intellij.tasks.impl.LocalTaskImpl) BranchInfo(com.intellij.tasks.BranchInfo) LocalTask(com.intellij.tasks.LocalTask)

Example 12 with LocalTaskImpl

use of com.intellij.tasks.impl.LocalTaskImpl in project intellij-community by JetBrains.

the class TaskVcsTest method testRestoreChangelist.

public void testRestoreChangelist() throws Exception {
    final LocalTaskImpl task = new LocalTaskImpl("foo", "bar");
    activateAndCreateChangelist(task);
    activateAndCreateChangelist(new LocalTaskImpl("next", ""));
    final String changelistName = myTaskManager.getChangelistName(task);
    myChangeListManager.removeChangeList(changelistName);
    myChangeListManager.invokeAfterUpdate(() -> {
        assertTrue(myTaskManager.isLocallyClosed(task));
        activateAndCreateChangelist(task);
        assertNotNull(myChangeListManager.findChangeList(changelistName));
    }, InvokeAfterUpdateMode.SYNCHRONOUS_NOT_CANCELLABLE, "foo", ModalityState.NON_MODAL);
}
Also used : LocalTaskImpl(com.intellij.tasks.impl.LocalTaskImpl)

Example 13 with LocalTaskImpl

use of com.intellij.tasks.impl.LocalTaskImpl in project intellij-community by JetBrains.

the class TaskVcsTest method testSuggestBranchName.

public void testSuggestBranchName() throws Exception {
    Task task = myRepository.findTask("TEST-001");
    assertNotNull(task);
    assertTrue(task.isIssue());
    assertEquals("TEST-001", myTaskManager.suggestBranchName(task));
    LocalTaskImpl simple = new LocalTaskImpl("1", "simple");
    assertEquals("simple", myTaskManager.suggestBranchName(simple));
    LocalTaskImpl strange = new LocalTaskImpl("1", "very long and strange summary");
    assertEquals("very-long", myTaskManager.suggestBranchName(strange));
    myTaskManager.getState().branchNameFormat = "{id} {summary}";
    LocalTaskImpl withIllegalSymbolsInIssue = new LocalTaskImpl("1", "contains Illegal$Symbols");
    withIllegalSymbolsInIssue.setIssue(true);
    assertEquals("1-contains-Illegal$Symbols", myTaskManager.suggestBranchName(withIllegalSymbolsInIssue));
}
Also used : LocalTaskImpl(com.intellij.tasks.impl.LocalTaskImpl)

Example 14 with LocalTaskImpl

use of com.intellij.tasks.impl.LocalTaskImpl in project intellij-community by JetBrains.

the class TaskVcsTest method testIds.

public void testIds() throws Exception {
    LocalTaskImpl task = new LocalTaskImpl("", "");
    assertEquals("", task.getNumber());
    assertEquals(null, task.getProject());
    task = new LocalTaskImpl("-", "");
    assertEquals("-", task.getNumber());
    assertEquals(null, task.getProject());
    task = new LocalTaskImpl("foo", "");
    assertEquals("foo", task.getNumber());
    assertEquals(null, task.getProject());
    task = new LocalTaskImpl("112", "");
    assertEquals("112", task.getNumber());
    assertEquals(null, task.getProject());
}
Also used : LocalTaskImpl(com.intellij.tasks.impl.LocalTaskImpl)

Example 15 with LocalTaskImpl

use of com.intellij.tasks.impl.LocalTaskImpl in project intellij-community by JetBrains.

the class EditTaskAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    Project project = getEventProject(e);
    if (project != null) {
        LocalTaskImpl task = (LocalTaskImpl) TaskManager.getManager(project).getActiveTask();
        new EditTaskDialog(project, task).show();
    }
}
Also used : Project(com.intellij.openapi.project.Project) LocalTaskImpl(com.intellij.tasks.impl.LocalTaskImpl)

Aggregations

LocalTaskImpl (com.intellij.tasks.impl.LocalTaskImpl)20 LocalTask (com.intellij.tasks.LocalTask)5 Repository (com.intellij.dvcs.repo.Repository)4 BranchInfo (com.intellij.tasks.BranchInfo)2 Gson (com.google.gson.Gson)1 JsonArray (com.google.gson.JsonArray)1 JsonObject (com.google.gson.JsonObject)1 LookupElement (com.intellij.codeInsight.lookup.LookupElement)1 Project (com.intellij.openapi.project.Project)1 Ref (com.intellij.openapi.util.Ref)1 Task (com.intellij.tasks.Task)1 TaskManager (com.intellij.tasks.TaskManager)1 OpenTaskDialog (com.intellij.tasks.actions.OpenTaskDialog)1 GitlabTask (com.intellij.tasks.gitlab.GitlabTask)1 GitlabIssue (com.intellij.tasks.gitlab.model.GitlabIssue)1 GitlabProject (com.intellij.tasks.gitlab.model.GitlabProject)1 TaskManagerImpl (com.intellij.tasks.impl.TaskManagerImpl)1 SimpleActionGroup (com.intellij.tools.SimpleActionGroup)1 HttpClient (org.apache.commons.httpclient.HttpClient)1 GetMethod (org.apache.commons.httpclient.methods.GetMethod)1