Search in sources :

Example 26 with LocalChangeList

use of com.intellij.openapi.vcs.changes.LocalChangeList in project intellij-community by JetBrains.

the class AssociateWithTaskAction method setSelected.

@Override
public void setSelected(AnActionEvent e, boolean state) {
    ChangeList[] lists = e.getData(VcsDataKeys.CHANGE_LISTS);
    if (lists == null) {
        return;
    }
    Project project = e.getData(CommonDataKeys.PROJECT);
    TaskManager manager = TaskManager.getManager(project);
    for (ChangeList list : lists) {
        if (list instanceof LocalChangeList) {
            manager.trackContext((LocalChangeList) list);
        }
    }
}
Also used : Project(com.intellij.openapi.project.Project) TaskManager(com.intellij.tasks.TaskManager) LocalChangeList(com.intellij.openapi.vcs.changes.LocalChangeList) ChangeList(com.intellij.openapi.vcs.changes.ChangeList) LocalChangeList(com.intellij.openapi.vcs.changes.LocalChangeList)

Example 27 with LocalChangeList

use of com.intellij.openapi.vcs.changes.LocalChangeList in project intellij-community by JetBrains.

the class AssociateWithTaskAction method isSelected.

@Override
public boolean isSelected(AnActionEvent e) {
    ChangeList[] lists = e.getData(VcsDataKeys.CHANGE_LISTS);
    if (lists == null) {
        return false;
    }
    Project project = e.getData(CommonDataKeys.PROJECT);
    TaskManager manager = TaskManager.getManager(project);
    for (ChangeList list : lists) {
        if (list instanceof LocalChangeList && manager.getAssociatedTask((LocalChangeList) list) == null) {
            return false;
        }
    }
    return true;
}
Also used : Project(com.intellij.openapi.project.Project) TaskManager(com.intellij.tasks.TaskManager) LocalChangeList(com.intellij.openapi.vcs.changes.LocalChangeList) ChangeList(com.intellij.openapi.vcs.changes.ChangeList) LocalChangeList(com.intellij.openapi.vcs.changes.LocalChangeList)

Example 28 with LocalChangeList

use of com.intellij.openapi.vcs.changes.LocalChangeList in project intellij-community by JetBrains.

the class EditTaskDialog method doOKAction.

@Override
protected void doOKAction() {
    myTask.setSummary(mySummary.getText());
    if (myChangelist.isVisible()) {
        List<ChangeListInfo> changeLists = myTask.getChangeLists();
        changeLists.clear();
        LocalChangeList item = (LocalChangeList) myChangelist.getSelectedItem();
        if (item != null) {
            changeLists.add(new ChangeListInfo(item));
        }
    }
    if (myBranch.isVisible()) {
        List<BranchInfo> branches = myTask.getBranches();
        branches.clear();
        VcsTaskHandler.TaskInfo branch = (VcsTaskHandler.TaskInfo) myBranch.getSelectedItem();
        if (branch != null) {
            List<BranchInfo> infos = BranchInfo.fromTaskInfo(branch, false);
            branches.addAll(infos);
        }
    }
    close(OK_EXIT_CODE);
}
Also used : BranchInfo(com.intellij.tasks.BranchInfo) VcsTaskHandler(com.intellij.openapi.vcs.VcsTaskHandler) LocalChangeList(com.intellij.openapi.vcs.changes.LocalChangeList) ChangeListInfo(com.intellij.tasks.ChangeListInfo)

Example 29 with LocalChangeList

use of com.intellij.openapi.vcs.changes.LocalChangeList in project intellij-community by JetBrains.

the class SvnConcurrentChangeListManagerTest method testDoubleMove.

@Test
public void testDoubleMove() throws Exception {
    enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
    final VirtualFile file = createFileInCommand("a.txt", "old content");
    final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
    changeListManager.ensureUpToDate(false);
    final LocalChangeList list = changeListManager.addChangeList("test", null);
    final LocalChangeList target = changeListManager.addChangeList("target", null);
    final LocalChangeList target2 = changeListManager.addChangeList("target2", null);
    changeListManager.moveChangesTo(list, new Change[] { changeListManager.getChange(file) });
    myScheme.doTest(() -> {
        changeListManager.moveChangesTo(target, new Change[] { changeListManager.getChange(file) });
        checkFilesAreInList(new VirtualFile[] { file }, target.getName(), changeListManager);
        changeListManager.moveChangesTo(target2, new Change[] { changeListManager.getChange(file) });
        checkFilesAreInList(new VirtualFile[] { file }, target2.getName(), changeListManager);
    });
    checkFilesAreInList(new VirtualFile[] { file }, target2.getName(), changeListManager);
    changeListManager.ensureUpToDate(false);
    checkFilesAreInList(new VirtualFile[] { file }, target2.getName(), changeListManager);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) LocalChangeList(com.intellij.openapi.vcs.changes.LocalChangeList) ChangeListManager(com.intellij.openapi.vcs.changes.ChangeListManager) Test(org.junit.Test)

Example 30 with LocalChangeList

use of com.intellij.openapi.vcs.changes.LocalChangeList in project intellij-community by JetBrains.

the class SvnConcurrentChangeListManagerTest method testMove.

@Test
public void testMove() throws Exception {
    enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
    final VirtualFile file = createFileInCommand("a.txt", "old content");
    final ChangeListManager changeListManager = ChangeListManager.getInstance(myProject);
    changeListManager.ensureUpToDate(false);
    final LocalChangeList list = changeListManager.addChangeList("test", null);
    final LocalChangeList target = changeListManager.addChangeList("target", null);
    changeListManager.moveChangesTo(list, new Change[] { changeListManager.getChange(file) });
    myScheme.doTest(() -> {
        changeListManager.moveChangesTo(target, new Change[] { changeListManager.getChange(file) });
        checkFilesAreInList(new VirtualFile[] { file }, target.getName(), changeListManager);
    });
    checkFilesAreInList(new VirtualFile[] { file }, target.getName(), changeListManager);
    changeListManager.ensureUpToDate(false);
    checkFilesAreInList(new VirtualFile[] { file }, target.getName(), changeListManager);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) LocalChangeList(com.intellij.openapi.vcs.changes.LocalChangeList) ChangeListManager(com.intellij.openapi.vcs.changes.ChangeListManager) Test(org.junit.Test)

Aggregations

LocalChangeList (com.intellij.openapi.vcs.changes.LocalChangeList)44 ChangeListManager (com.intellij.openapi.vcs.changes.ChangeListManager)25 VirtualFile (com.intellij.openapi.vfs.VirtualFile)23 Test (org.junit.Test)20 Project (com.intellij.openapi.project.Project)8 Change (com.intellij.openapi.vcs.changes.Change)7 ChangeList (com.intellij.openapi.vcs.changes.ChangeList)5 TaskManager (com.intellij.tasks.TaskManager)3 List (java.util.List)3 Nullable (org.jetbrains.annotations.Nullable)3 ContentRevision (com.intellij.openapi.vcs.changes.ContentRevision)2 ChangeListInfo (com.intellij.tasks.ChangeListInfo)2 ArrayList (java.util.ArrayList)2 NotNull (org.jetbrains.annotations.NotNull)2 DataManager (com.intellij.ide.DataManager)1 Disposable (com.intellij.openapi.Disposable)1 com.intellij.openapi.actionSystem (com.intellij.openapi.actionSystem)1 Presentation (com.intellij.openapi.actionSystem.Presentation)1 ComboBoxAction (com.intellij.openapi.actionSystem.ex.ComboBoxAction)1 DumbAware (com.intellij.openapi.project.DumbAware)1