Search in sources :

Example 6 with GitModelWorkingTree

use of org.eclipse.egit.ui.internal.synchronize.model.GitModelWorkingTree 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 GitModelWorkingTree

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

the class GitChangeSetSorterTest method blobShouldBeGreaterThanWorkingTree.

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

Example 8 with GitModelWorkingTree

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

the class GitChangeSetSorterTest method commitTreeShouldBeGreaterThanWorkingTree.

/*
	 * Tests for GitModelCommit
	 */
@Test
public void commitTreeShouldBeGreaterThanWorkingTree() {
    // given
    Viewer viewer = mock(Viewer.class);
    GitChangeSetSorter sorter = new GitChangeSetSorter();
    GitModelCommit commit = mock(GitModelCommit.class);
    GitModelWorkingTree workingTree = mock(GitModelWorkingTree.class);
    // when
    int actual = sorter.compare(viewer, commit, workingTree);
    // then
    assertTrue(actual > 0);
}
Also used : GitModelCommit(org.eclipse.egit.ui.internal.synchronize.model.GitModelCommit) 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 9 with GitModelWorkingTree

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

the class GitChangeSetSorterTest method treeShouldBeGreaterThanWorkingTree.

/*
	 * Tests for GitModelTree
	 */
@Test
public void treeShouldBeGreaterThanWorkingTree() {
    // given
    Viewer viewer = mock(Viewer.class);
    GitChangeSetSorter sorter = new GitChangeSetSorter();
    GitModelTree tree = mock(GitModelTree.class);
    GitModelWorkingTree workingTree = mock(GitModelWorkingTree.class);
    // when
    int actual = sorter.compare(viewer, tree, workingTree);
    // then
    assertTrue(actual > 0);
}
Also used : GitModelTree(org.eclipse.egit.ui.internal.synchronize.model.GitModelTree) 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 10 with GitModelWorkingTree

use of org.eclipse.egit.ui.internal.synchronize.model.GitModelWorkingTree 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

GitModelWorkingTree (org.eclipse.egit.ui.internal.synchronize.model.GitModelWorkingTree)10 Viewer (org.eclipse.jface.viewers.Viewer)8 CommonViewer (org.eclipse.ui.navigator.CommonViewer)8 Test (org.junit.Test)8 GitModelCache (org.eclipse.egit.ui.internal.synchronize.model.GitModelCache)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