use of org.eclipse.egit.ui.internal.history.HistoryPageInput in project egit by eclipse.
the class RepositoriesView method getShowInContext.
@Override
public ShowInContext getShowInContext() {
IStructuredSelection selection = (IStructuredSelection) getCommonViewer().getSelection();
List<Object> elements = getShowInElements(selection);
// GenericHistoryView only shows a selection of a single resource (see
// bug 392949), so prepare our own history page input which can contain
// multiple files to support showing more than one file in history.
// It's also necessary for a single file that is outside of the
// workspace (and as such is not an IResource).
HistoryPageInput historyPageInput = getHistoryPageInput(selection);
return new ShowInContext(historyPageInput, new StructuredSelection(elements));
}
use of org.eclipse.egit.ui.internal.history.HistoryPageInput 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);
}
}
use of org.eclipse.egit.ui.internal.history.HistoryPageInput 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;
}
Aggregations