Search in sources :

Example 1 with GitHistoryPage

use of org.eclipse.egit.ui.internal.history.GitHistoryPage in project egit by eclipse.

the class CheckoutCommitHandler method isEnabled.

@Override
public boolean isEnabled() {
    GitHistoryPage page = getPage();
    if (page == null)
        return false;
    IStructuredSelection sel = getSelection(page);
    return sel.size() == 1 && sel.getFirstElement() instanceof RevCommit;
}
Also used : GitHistoryPage(org.eclipse.egit.ui.internal.history.GitHistoryPage) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) RevCommit(org.eclipse.jgit.revwalk.RevCommit)

Example 2 with GitHistoryPage

use of org.eclipse.egit.ui.internal.history.GitHistoryPage in project egit by eclipse.

the class CompareWithWorkingTreeHandler method isEnabled.

@Override
public boolean isEnabled() {
    GitHistoryPage page = getPage();
    if (page == null)
        return false;
    int size = getSelection(page).size();
    if (size != 1)
        return false;
    return page.getInputInternal().isSingleFile();
}
Also used : GitHistoryPage(org.eclipse.egit.ui.internal.history.GitHistoryPage)

Example 3 with GitHistoryPage

use of org.eclipse.egit.ui.internal.history.GitHistoryPage in project egit by eclipse.

the class CreateBranchOnCommitHandler method isEnabled.

@Override
public boolean isEnabled() {
    GitHistoryPage page = getPage();
    if (page == null)
        return false;
    IStructuredSelection sel = getSelection(page);
    return sel.size() == 1 && sel.getFirstElement() instanceof RevCommit;
}
Also used : GitHistoryPage(org.eclipse.egit.ui.internal.history.GitHistoryPage) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) RevCommit(org.eclipse.jgit.revwalk.RevCommit)

Example 4 with GitHistoryPage

use of org.eclipse.egit.ui.internal.history.GitHistoryPage in project egit by eclipse.

the class CreateTagOnCommitHandler method isEnabled.

@Override
public boolean isEnabled() {
    GitHistoryPage page = getPage();
    if (page == null)
        return false;
    IStructuredSelection sel = getSelection(page);
    return sel.size() == 1 && sel.getFirstElement() instanceof RevCommit;
}
Also used : GitHistoryPage(org.eclipse.egit.ui.internal.history.GitHistoryPage) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) RevCommit(org.eclipse.jgit.revwalk.RevCommit)

Example 5 with GitHistoryPage

use of org.eclipse.egit.ui.internal.history.GitHistoryPage in project egit by eclipse.

the class DeleteBranchOnCommitHandler method isEnabled.

@Override
public boolean isEnabled() {
    GitHistoryPage page = getPage();
    Repository repository = getRepository(page);
    if (repository == null)
        return false;
    List<Ref> branchesOfCommit;
    try {
        branchesOfCommit = getBranchesOfCommit(getSelection(page), repository, true);
    } catch (IOException e) {
        Activator.logError(UIText.AbstractHistoryCommitHandler_cantGetBranches, e);
        return false;
    }
    return !branchesOfCommit.isEmpty();
}
Also used : Repository(org.eclipse.jgit.lib.Repository) Ref(org.eclipse.jgit.lib.Ref) GitHistoryPage(org.eclipse.egit.ui.internal.history.GitHistoryPage) IOException(java.io.IOException)

Aggregations

GitHistoryPage (org.eclipse.egit.ui.internal.history.GitHistoryPage)17 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)10 RevCommit (org.eclipse.jgit.revwalk.RevCommit)9 Repository (org.eclipse.jgit.lib.Repository)6 IOException (java.io.IOException)2 Ref (org.eclipse.jgit.lib.Ref)2 IHistoryPage (org.eclipse.team.ui.history.IHistoryPage)2 IHistoryView (org.eclipse.team.ui.history.IHistoryView)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 IResource (org.eclipse.core.resources.IResource)1 ResourceMapping (org.eclipse.core.resources.mapping.ResourceMapping)1 CommitFileRevision (org.eclipse.egit.core.internal.storage.CommitFileRevision)1 BlameOperation (org.eclipse.egit.ui.internal.blame.BlameOperation)1 RepositoryTreeNode (org.eclipse.egit.ui.internal.repository.tree.RepositoryTreeNode)1 GitModelWorkbenchAdapter (org.eclipse.egit.ui.internal.synchronize.mapping.GitModelWorkbenchAdapter)1 GitModelBlob (org.eclipse.egit.ui.internal.synchronize.model.GitModelBlob)1 GitModelObject (org.eclipse.egit.ui.internal.synchronize.model.GitModelObject)1 GitModelTree (org.eclipse.egit.ui.internal.synchronize.model.GitModelTree)1