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);
}
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);
}
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);
}
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);
}
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;
}
Aggregations