Search in sources :

Example 6 with GitModelCache

use of org.eclipse.egit.ui.internal.synchronize.model.GitModelCache in project egit by eclipse.

the class GitChangeSetSorterTest method workingTreeShouldBeLessThanCacheTree.

/*
	 * Tests for GitModelWorkingTree
	 */
@Test
public void workingTreeShouldBeLessThanCacheTree() {
    // given
    Viewer viewer = mock(Viewer.class);
    GitChangeSetSorter sorter = new GitChangeSetSorter();
    GitModelCache cache = mock(GitModelCache.class);
    GitModelWorkingTree workingTree = mock(GitModelWorkingTree.class);
    // when
    int actual = sorter.compare(viewer, workingTree, cache);
    // then
    assertTrue(actual < 0);
}
Also used : GitModelCache(org.eclipse.egit.ui.internal.synchronize.model.GitModelCache) CommonViewer(org.eclipse.ui.navigator.CommonViewer) Viewer(org.eclipse.jface.viewers.Viewer) GitModelWorkingTree(org.eclipse.egit.ui.internal.synchronize.model.GitModelWorkingTree) Test(org.junit.Test)

Example 7 with GitModelCache

use of org.eclipse.egit.ui.internal.synchronize.model.GitModelCache in project egit by eclipse.

the class GitChangeSetSorterTest method cacheTreeShouldBeLessThanBlob.

@Test
public void cacheTreeShouldBeLessThanBlob() {
    // given
    Viewer viewer = mock(Viewer.class);
    GitChangeSetSorter sorter = new GitChangeSetSorter();
    GitModelCache cache = mock(GitModelCache.class);
    GitModelBlob blob = mock(GitModelBlob.class);
    // when
    int actual = sorter.compare(viewer, cache, blob);
    // then
    assertTrue(actual < 0);
}
Also used : GitModelCache(org.eclipse.egit.ui.internal.synchronize.model.GitModelCache) CommonViewer(org.eclipse.ui.navigator.CommonViewer) Viewer(org.eclipse.jface.viewers.Viewer) GitModelBlob(org.eclipse.egit.ui.internal.synchronize.model.GitModelBlob) Test(org.junit.Test)

Example 8 with GitModelCache

use of org.eclipse.egit.ui.internal.synchronize.model.GitModelCache in project egit by eclipse.

the class GitChangeSetSorterTest method treeShouldBeGreaterThanCache.

@Test
public void treeShouldBeGreaterThanCache() {
    // given
    Viewer viewer = mock(Viewer.class);
    GitChangeSetSorter sorter = new GitChangeSetSorter();
    GitModelTree tree = mock(GitModelTree.class);
    GitModelCache cache = mock(GitModelCache.class);
    // when
    int actual = sorter.compare(viewer, tree, cache);
    // then
    assertTrue(actual > 0);
}
Also used : GitModelCache(org.eclipse.egit.ui.internal.synchronize.model.GitModelCache) GitModelTree(org.eclipse.egit.ui.internal.synchronize.model.GitModelTree) CommonViewer(org.eclipse.ui.navigator.CommonViewer) Viewer(org.eclipse.jface.viewers.Viewer) Test(org.junit.Test)

Example 9 with GitModelCache

use of org.eclipse.egit.ui.internal.synchronize.model.GitModelCache in project egit by eclipse.

the class GitChangeSetSorterTest method blobShouldBeGreaterThanCache.

@Test
public void blobShouldBeGreaterThanCache() {
    // given
    Viewer viewer = mock(Viewer.class);
    GitChangeSetSorter sorter = new GitChangeSetSorter();
    GitModelBlob blob = mock(GitModelBlob.class);
    GitModelCache cache = mock(GitModelCache.class);
    // when
    int actual = sorter.compare(viewer, blob, cache);
    // then
    assertTrue(actual > 0);
}
Also used : GitModelCache(org.eclipse.egit.ui.internal.synchronize.model.GitModelCache) CommonViewer(org.eclipse.ui.navigator.CommonViewer) Viewer(org.eclipse.jface.viewers.Viewer) GitModelBlob(org.eclipse.egit.ui.internal.synchronize.model.GitModelBlob) Test(org.junit.Test)

Example 10 with GitModelCache

use of org.eclipse.egit.ui.internal.synchronize.model.GitModelCache in project egit by eclipse.

the class GitChangeSetDropAdapterAssistant method validateDrop.

@Override
public IStatus validateDrop(Object target, int operationCode, TransferData transferType) {
    TreeSelection selection = (TreeSelection) LocalSelectionTransfer.getTransfer().getSelection();
    String operation = getOperationType(selection);
    if (!UNSUPPORTED_OP.equals(operation)) {
        if (target instanceof GitModelWorkingTree) {
            if (UNSTAGE_OP.equals(operation))
                return Status.OK_STATUS;
        } else if (STAGE_OP.equals(operation) && target instanceof GitModelCache)
            return Status.OK_STATUS;
    }
    return Status.CANCEL_STATUS;
}
Also used : GitModelCache(org.eclipse.egit.ui.internal.synchronize.model.GitModelCache) TreeSelection(org.eclipse.jface.viewers.TreeSelection) GitModelWorkingTree(org.eclipse.egit.ui.internal.synchronize.model.GitModelWorkingTree)

Aggregations

GitModelCache (org.eclipse.egit.ui.internal.synchronize.model.GitModelCache)10 Viewer (org.eclipse.jface.viewers.Viewer)8 CommonViewer (org.eclipse.ui.navigator.CommonViewer)8 Test (org.junit.Test)8 GitModelWorkingTree (org.eclipse.egit.ui.internal.synchronize.model.GitModelWorkingTree)4 GitModelBlob (org.eclipse.egit.ui.internal.synchronize.model.GitModelBlob)3 GitModelCommit (org.eclipse.egit.ui.internal.synchronize.model.GitModelCommit)3 GitModelTree (org.eclipse.egit.ui.internal.synchronize.model.GitModelTree)3 Commit (org.eclipse.egit.core.synchronize.GitCommitsModelCache.Commit)1 TreeSelection (org.eclipse.jface.viewers.TreeSelection)1