use of org.eclipse.egit.ui.internal.synchronize.model.GitModelBlob 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.GitModelBlob in project egit by eclipse.
the class GitChangeSetSorterTest method shouldOrderBlobsAlphabetically.
@Test
public void shouldOrderBlobsAlphabetically() {
// given
CommonViewer viewer = mock(CommonViewer.class);
GitChangeSetSorter sorter = new GitChangeSetSorter();
GitModelBlob blob1 = mock(GitModelBlob.class);
GitModelBlob blob2 = mock(GitModelBlob.class);
ILabelProvider labelProvider = mock(ILabelProvider.class);
when(labelProvider.getText(blob1)).thenReturn("aaa");
when(labelProvider.getText(blob2)).thenReturn("zzz");
when(viewer.getLabelProvider()).thenReturn(labelProvider);
// when
int actual1 = sorter.compare(viewer, blob1, blob2);
int actual2 = sorter.compare(viewer, blob2, blob1);
// then
assertTrue(actual1 < 0);
assertTrue(actual2 > 0);
}
use of org.eclipse.egit.ui.internal.synchronize.model.GitModelBlob in project egit by eclipse.
the class GitOpenInCompareAction method run.
@Override
public void run() {
ISelection selection = conf.getSite().getSelectionProvider().getSelection();
if (selection instanceof IStructuredSelection) {
IStructuredSelection sel = ((IStructuredSelection) selection);
boolean reuseEditor = sel.size() == 1;
for (Iterator iterator = sel.iterator(); iterator.hasNext(); ) {
Object obj = iterator.next();
if (obj instanceof GitModelBlob)
handleGitObjectComparison((GitModelBlob) obj, reuseEditor);
else {
oldAction.run();
// meet not know object
break;
}
}
}
}
Aggregations