Search in sources :

Example 6 with IHistoryView

use of org.eclipse.team.ui.history.IHistoryView in project egit by eclipse.

the class AbstractHistoryCommandHandler method getPageFromPart.

private GitHistoryPage getPageFromPart(IWorkbenchPart part) {
    if (!(part instanceof IHistoryView))
        return null;
    IHistoryView view = (IHistoryView) part;
    IHistoryPage page = view.getHistoryPage();
    if (page instanceof GitHistoryPage)
        return (GitHistoryPage) page;
    return null;
}
Also used : IHistoryPage(org.eclipse.team.ui.history.IHistoryPage) GitHistoryPage(org.eclipse.egit.ui.internal.history.GitHistoryPage) IHistoryView(org.eclipse.team.ui.history.IHistoryView)

Example 7 with IHistoryView

use of org.eclipse.team.ui.history.IHistoryView in project egit by eclipse.

the class BlameInformationControl method showCommitInHistory.

private void showCommitInHistory() {
    getShell().dispose();
    IHistoryView part;
    try {
        part = (IHistoryView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(IHistoryView.VIEW_ID);
    } catch (PartInitException e) {
        Activator.logError(e.getLocalizedMessage(), e);
        return;
    }
    if (part == null)
        return;
    Repository repository = revision.getRepository();
    if (!repository.isBare()) {
        String sourcePath = revision.getSourcePath();
        File file = new File(repository.getWorkTree(), sourcePath);
        BlameHistoryPageInput input = new BlameHistoryPageInput(repository, revision.getCommit(), file);
        part.showHistoryFor(input);
    } else {
        HistoryPageInput input = new BlameHistoryPageInput(repository, revision.getCommit());
        part.showHistoryFor(input);
    }
}
Also used : Repository(org.eclipse.jgit.lib.Repository) BlameHistoryPageInput(org.eclipse.egit.ui.internal.blame.BlameOperation.BlameHistoryPageInput) HistoryPageInput(org.eclipse.egit.ui.internal.history.HistoryPageInput) PartInitException(org.eclipse.ui.PartInitException) IHistoryView(org.eclipse.team.ui.history.IHistoryView) File(java.io.File) BlameHistoryPageInput(org.eclipse.egit.ui.internal.blame.BlameOperation.BlameHistoryPageInput)

Example 8 with IHistoryView

use of org.eclipse.team.ui.history.IHistoryView in project egit by eclipse.

the class ShowHistoryActionHandler method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    final Repository repo = getRepository(true, event);
    // assert all resources map to the same repository
    if (repo == null) {
        return null;
    }
    try {
        IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);
        if (activeWorkbenchWindow != null) {
            IWorkbenchPage page = activeWorkbenchWindow.getActivePage();
            if (page != null) {
                IResource[] resources = getSelectedResources(event);
                IHistoryView view = (IHistoryView) page.showView(IHistoryView.VIEW_ID);
                if (resources.length == 1) {
                    view.showHistoryFor(resources[0]);
                    return null;
                }
                HistoryPageInput list = new HistoryPageInput(repo, resources);
                view.showHistoryFor(list);
            }
        }
    } catch (PartInitException e) {
        throw new ExecutionException(e.getMessage(), e);
    }
    return null;
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) Repository(org.eclipse.jgit.lib.Repository) HistoryPageInput(org.eclipse.egit.ui.internal.history.HistoryPageInput) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) PartInitException(org.eclipse.ui.PartInitException) ExecutionException(org.eclipse.core.commands.ExecutionException) IHistoryView(org.eclipse.team.ui.history.IHistoryView) IResource(org.eclipse.core.resources.IResource)

Aggregations

IHistoryView (org.eclipse.team.ui.history.IHistoryView)8 Repository (org.eclipse.jgit.lib.Repository)4 File (java.io.File)3 IResource (org.eclipse.core.resources.IResource)3 IHistoryPage (org.eclipse.team.ui.history.IHistoryPage)3 PartInitException (org.eclipse.ui.PartInitException)3 ExecutionException (org.eclipse.core.commands.ExecutionException)2 GitHistoryPage (org.eclipse.egit.ui.internal.history.GitHistoryPage)2 HistoryPageInput (org.eclipse.egit.ui.internal.history.HistoryPageInput)2 RepositoriesView (org.eclipse.egit.ui.internal.repository.RepositoriesView)2 RepositoryNode (org.eclipse.egit.ui.internal.repository.tree.RepositoryNode)2 GenericHistoryView (org.eclipse.team.internal.ui.history.GenericHistoryView)2 ResourceMapping (org.eclipse.core.resources.mapping.ResourceMapping)1 RepositoryUtil (org.eclipse.egit.core.RepositoryUtil)1 CloneOperation (org.eclipse.egit.core.op.CloneOperation)1 BlameHistoryPageInput (org.eclipse.egit.ui.internal.blame.BlameOperation.BlameHistoryPageInput)1 RepositoryCommit (org.eclipse.egit.ui.internal.commit.RepositoryCommit)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