Search in sources :

Example 11 with RepositoryCommit

use of org.eclipse.egit.ui.internal.commit.RepositoryCommit in project egit by eclipse.

the class BlameInformationControl method openCommit.

private void openCommit() {
    try {
        getShell().dispose();
        CommitEditor.open(new RepositoryCommit(revision.getRepository(), revision.getCommit()));
    } catch (PartInitException pie) {
        Activator.logError(pie.getLocalizedMessage(), pie);
    }
}
Also used : PartInitException(org.eclipse.ui.PartInitException) RepositoryCommit(org.eclipse.egit.ui.internal.commit.RepositoryCommit)

Example 12 with RepositoryCommit

use of org.eclipse.egit.ui.internal.commit.RepositoryCommit in project egit by eclipse.

the class CheckoutHandler method execute.

@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
    final List<RepositoryCommit> commits = getCommits(event);
    if (commits.size() == 1) {
        final RepositoryCommit commit = commits.get(0);
        BranchOperationUI.checkout(commit.getRepository(), commit.getRevCommit().name()).start();
    }
    return null;
}
Also used : RepositoryCommit(org.eclipse.egit.ui.internal.commit.RepositoryCommit)

Example 13 with RepositoryCommit

use of org.eclipse.egit.ui.internal.commit.RepositoryCommit in project egit by eclipse.

the class CreateBranchHandler method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    List<RepositoryCommit> commits = getCommits(event);
    if (commits.size() == 1) {
        RepositoryCommit commit = commits.get(0);
        WizardDialog dlg = new WizardDialog(HandlerUtil.getActiveShellChecked(event), new CreateBranchWizard(commit.getRepository(), commit.getRevCommit().name()));
        dlg.setHelpAvailable(false);
        dlg.open();
    }
    return null;
}
Also used : RepositoryCommit(org.eclipse.egit.ui.internal.commit.RepositoryCommit) WizardDialog(org.eclipse.jface.wizard.WizardDialog) CreateBranchWizard(org.eclipse.egit.ui.internal.repository.CreateBranchWizard)

Example 14 with RepositoryCommit

use of org.eclipse.egit.ui.internal.commit.RepositoryCommit in project egit by eclipse.

the class CreateTagHandler method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    List<RepositoryCommit> commits = getCommits(event);
    if (commits.size() == 1) {
        RepositoryCommit commit = commits.get(0);
        Repository repository = commit.getRepository();
        CreateTagDialog dialog = new CreateTagDialog(HandlerUtil.getActiveShellChecked(event), commit.getRevCommit().getId(), repository);
        if (dialog.open() != Window.OK)
            return null;
        final TagBuilder tag = new TagBuilder();
        PersonIdent personIdent = new PersonIdent(repository);
        String tagName = dialog.getTagName();
        tag.setTag(tagName);
        tag.setTagger(personIdent);
        tag.setMessage(dialog.getTagMessage());
        tag.setObjectId(commit.getRevCommit());
        try {
            new TagOperation(repository, tag, dialog.shouldOverWriteTag()).execute(new NullProgressMonitor());
        } catch (CoreException e) {
            throw new ExecutionException(e.getMessage(), e);
        }
        if (dialog.shouldStartPushWizard())
            PushTagsWizard.openWizardDialog(repository, tagName);
    }
    return null;
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) Repository(org.eclipse.jgit.lib.Repository) CoreException(org.eclipse.core.runtime.CoreException) CreateTagDialog(org.eclipse.egit.ui.internal.dialogs.CreateTagDialog) PersonIdent(org.eclipse.jgit.lib.PersonIdent) TagOperation(org.eclipse.egit.core.op.TagOperation) ExecutionException(org.eclipse.core.commands.ExecutionException) RepositoryCommit(org.eclipse.egit.ui.internal.commit.RepositoryCommit) TagBuilder(org.eclipse.jgit.lib.TagBuilder)

Example 15 with RepositoryCommit

use of org.eclipse.egit.ui.internal.commit.RepositoryCommit in project egit by eclipse.

the class ShowInHistoryHandler method execute.

@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
    List<RepositoryCommit> commits = getCommits(event);
    if (commits.size() == 1) {
        RepositoryCommit repoCommit = commits.get(0);
        try {
            IHistoryView view = (IHistoryView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(IHistoryView.VIEW_ID);
            view.showHistoryFor(repoCommit);
        } catch (PartInitException e) {
            throw new ExecutionException(e.getMessage(), e);
        }
    }
    return null;
}
Also used : PartInitException(org.eclipse.ui.PartInitException) ExecutionException(org.eclipse.core.commands.ExecutionException) RepositoryCommit(org.eclipse.egit.ui.internal.commit.RepositoryCommit) IHistoryView(org.eclipse.team.ui.history.IHistoryView)

Aggregations

RepositoryCommit (org.eclipse.egit.ui.internal.commit.RepositoryCommit)34 RevCommit (org.eclipse.jgit.revwalk.RevCommit)15 Repository (org.eclipse.jgit.lib.Repository)13 Test (org.junit.Test)10 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)7 IOException (java.io.IOException)6 ExecutionException (org.eclipse.core.commands.ExecutionException)6 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)6 ArrayList (java.util.ArrayList)5 ObjectId (org.eclipse.jgit.lib.ObjectId)5 UIText (org.eclipse.egit.ui.internal.UIText)4 RevWalk (org.eclipse.jgit.revwalk.RevWalk)4 IEditorPart (org.eclipse.ui.IEditorPart)4 CommitEditorInput (org.eclipse.egit.ui.internal.commit.CommitEditorInput)3 PartInitException (org.eclipse.ui.PartInitException)3 Map (java.util.Map)2 AtomicReference (java.util.concurrent.atomic.AtomicReference)2 IResource (org.eclipse.core.resources.IResource)2 CoreException (org.eclipse.core.runtime.CoreException)2 IAdaptable (org.eclipse.core.runtime.IAdaptable)2