use of org.eclipse.egit.ui.internal.history.GitHistoryPage in project egit by eclipse.
the class PushCommitHandler 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;
}
use of org.eclipse.egit.ui.internal.history.GitHistoryPage in project egit by eclipse.
the class RewordHandler method isEnabled.
@Override
public boolean isEnabled() {
GitHistoryPage page = getPage();
if (page == null)
return false;
IStructuredSelection selection = getSelection(page);
if (selection.size() != 1)
return false;
Repository repository = getRepository(page);
if (repository.getRepositoryState() != RepositoryState.SAFE)
return false;
RevCommit commit = (RevCommit) selection.getFirstElement();
return (commit.getParentCount() == 1);
}
use of org.eclipse.egit.ui.internal.history.GitHistoryPage in project egit by eclipse.
the class SetQuickdiffBaselineHandler method isEnabled.
@Override
public boolean isEnabled() {
GitHistoryPage page = getPage();
if (page == null)
return false;
IStructuredSelection selection = getSelection(page);
return selection.size() == 1;
}
use of org.eclipse.egit.ui.internal.history.GitHistoryPage in project egit by eclipse.
the class ShowBlameHandler method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
GitHistoryPage page = getPage(event);
if (page == null) {
return null;
}
Object input = page.getInputInternal().getSingleItem();
if (input == null) {
return null;
}
Repository repo = getRepository(event);
if (repo == null) {
return null;
}
String path = getPath(repo, page);
if (path == null) {
return null;
}
RevCommit commit = getSelectedCommit(event);
if (commit == null) {
return null;
}
try {
IFileRevision revision = CompareUtils.getFileRevision(path, commit, repo, null);
if (revision instanceof CommitFileRevision) {
BlameOperation op = new BlameOperation((CommitFileRevision) revision, HandlerUtil.getActiveShell(event), page.getSite().getPage());
JobUtil.scheduleUserJob(op, UIText.ShowBlameHandler_JobName, JobFamilies.BLAME);
}
} catch (IOException e) {
Activator.showError(UIText.ShowBlameHandler_errorMessage, e);
}
return null;
}
use of org.eclipse.egit.ui.internal.history.GitHistoryPage in project egit by eclipse.
the class ShowVersionsHandler method isEnabled.
@Override
public boolean isEnabled() {
GitHistoryPage page = getPage();
if (page == null)
return false;
int size = getSelection(page).size();
if (size == 0)
return false;
return page.getInputInternal().isSingleFile();
}
Aggregations