use of org.eclipse.egit.ui.internal.commit.RepositoryCommit in project egit by eclipse.
the class CommitEditorInputFactoryTest method shouldPersistAndRestoreCommit.
@Test
public void shouldPersistAndRestoreCommit() {
RepositoryCommit repositoryCommit = new RepositoryCommit(repository, commit);
new CommitEditorInput(repositoryCommit).saveState(memento);
IAdaptable restored = new CommitEditorInputFactory().createElement(memento);
assertNotNull(restored);
assertThat(restored, instanceOf(CommitEditorInput.class));
assertThat(repositoryCommit, isSameCommit(((CommitEditorInput) restored).getCommit()));
}
use of org.eclipse.egit.ui.internal.commit.RepositoryCommit in project egit by eclipse.
the class CommitEditorInputFactoryTest method shouldPersistAndRestoreStashCommit.
@Test
public void shouldPersistAndRestoreStashCommit() {
RepositoryCommit stashCommit = new RepositoryCommit(repository, commit);
stashCommit.setStash(true);
new CommitEditorInput(stashCommit).saveState(memento);
IAdaptable restored = new CommitEditorInputFactory().createElement(memento);
assertNotNull(restored);
assertThat(restored, instanceOf(CommitEditorInput.class));
assertThat(stashCommit, isSameCommit(((CommitEditorInput) restored).getCommit()));
}
use of org.eclipse.egit.ui.internal.commit.RepositoryCommit in project egit by eclipse.
the class CommitEditorInputTest method testInput.
@Test
public void testInput() {
RepositoryCommit repoCommit = new RepositoryCommit(repository, commit);
CommitEditorInput input = new CommitEditorInput(repoCommit);
assertNotNull(input.getImageDescriptor());
assertNotNull(input.getToolTipText());
assertNotNull(input.getName());
assertEquals(repoCommit, input.getCommit());
assertNotNull(input.getPersistable());
}
use of org.eclipse.egit.ui.internal.commit.RepositoryCommit in project egit by eclipse.
the class CommitEditorTest method showAnnotations.
@Test
public void showAnnotations() throws Exception {
final AtomicReference<IEditorPart> editorRef = new AtomicReference<>();
PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
@Override
public void run() {
RepositoryCommit repoCommit = new RepositoryCommit(repository, commit);
editorRef.set(CommitEditor.openQuiet(repoCommit));
}
});
assertNotNull(editorRef.get());
SWTBotEditor commitEditor = bot.activeEditor();
SWTBotTable table = commitEditor.bot().table(1);
assertTrue(table.rowCount() > 0);
table.select(0);
ContextMenuHelper.clickContextMenuSync(table, UIText.CommitFileDiffViewer_ShowAnnotationsMenuLabel);
TestUtil.joinJobs(JobFamilies.BLAME);
assertFalse(commitEditor.getReference().equals(bot.activeEditor().getReference()));
final String content = getTestFileContent();
// Change working directory content to validate blame opens HEAD
setTestFileContent("updated content" + System.nanoTime());
assertEquals(content, bot.activeEditor().toTextEditor().getText());
}
use of org.eclipse.egit.ui.internal.commit.RepositoryCommit in project egit by eclipse.
the class CherryPickHandler method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
RevCommit commit = getSelectedCommit(event);
Repository repo = getRepository(event);
if (repo == null)
return null;
final IStructuredSelection selected = new StructuredSelection(new RepositoryCommit(repo, commit));
CommonUtils.runCommand(org.eclipse.egit.ui.internal.commit.command.CherryPickHandler.ID, selected);
return null;
}
Aggregations