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;
}
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);
}
}
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;
}
Aggregations