Initial EGit contribution to eclipse.org
[egit.git] / org.eclipse.egit.ui / src / org / eclipse / egit / ui / GitHistoryPageSource.java
blob8c9fac7cf55472c008804eaa252053744a5d5828
1 /*******************************************************************************
2 * Copyright (C) 2007, Robin Rosenberg <robin.rosenberg@dewire.com>
3 * Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org>
5 * All rights reserved. This program and the accompanying materials
6 * are made available under the terms of the Eclipse Public License v1.0
7 * which accompanies this distribution, and is available at
8 * http://www.eclipse.org/legal/epl-v10.html
9 *******************************************************************************/
10 package org.eclipse.egit.ui;
12 import org.eclipse.core.resources.IResource;
13 import org.eclipse.egit.core.ResourceList;
14 import org.eclipse.egit.ui.internal.history.GitHistoryPage;
15 import org.eclipse.team.ui.history.HistoryPageSource;
16 import org.eclipse.ui.part.Page;
18 /**
19 * A helper class for constructing the {@link GitHistoryPage}.
21 public class GitHistoryPageSource extends HistoryPageSource {
22 public boolean canShowHistoryFor(final Object object) {
23 return GitHistoryPage.canShowHistoryFor(object);
26 public Page createPage(final Object object) {
27 final ResourceList input;
29 if (object instanceof ResourceList)
30 input = (ResourceList) object;
31 else if (object instanceof IResource)
32 input = new ResourceList(new IResource[] { (IResource) object });
33 else
34 input = new ResourceList(new IResource[0]);
36 final GitHistoryPage pg = new GitHistoryPage();
37 pg.setInput(input);
38 return pg;