Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java32
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/AbstractHistoryCommandHandler.java2
2 files changed, 33 insertions, 1 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java
index a72b7d237c..cb4f653b30 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java
@@ -807,15 +807,35 @@ public class GitHistoryPage extends HistoryPage implements RefsChangedListener {
@Override
public void setFocus() {
+ if (repoHasBeenRemoved(currentRepo))
+ clearHistoryPage();
+
graph.getControl().setFocus();
}
+ private boolean repoHasBeenRemoved(final Repository repo) {
+ return (repo != null && repo.getDirectory() != null && !repo
+ .getDirectory().exists());
+ }
+
+ private void clearHistoryPage() {
+ currentRepo = null;
+ name = ""; //$NON-NLS-1$
+ input = null;
+ commentViewer.setInput(null);
+ fileViewer.setInput(null);
+ setInput(null);
+ }
+
@Override
public Control getControl() {
return topControl;
}
public void refresh() {
+ if (repoHasBeenRemoved(currentRepo))
+ clearHistoryPage();
+
this.input = null;
inputSet();
}
@@ -1257,8 +1277,18 @@ public class GitHistoryPage extends HistoryPage implements RefsChangedListener {
GitTraceLocation.HISTORYVIEW.getLocation());
cancelRefreshJob();
+
+ if (input == null)
+ return;
Repository db = input.getRepository();
- AnyObjectId headId = resolveHead(db, false);
+ if (repoHasBeenRemoved(db)) {
+ clearHistoryPage();
+ return;
+ }
+
+ AnyObjectId headId = resolveHead(db, true);
+ if (headId == null)
+ return;
List<String> paths = buildFilterPaths(input.getItems(), input
.getFileList(), db);
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/AbstractHistoryCommandHandler.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/AbstractHistoryCommandHandler.java
index 55addf0002..b95e1b7991 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/AbstractHistoryCommandHandler.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/command/AbstractHistoryCommandHandler.java
@@ -74,6 +74,8 @@ abstract class AbstractHistoryCommandHandler extends AbstractHandler {
protected Repository getRepository(ExecutionEvent event)
throws ExecutionException {
Object input = getInput(event);
+ if (input == null)
+ return null;
if (input instanceof HistoryPageInput)
return ((HistoryPageInput) input).getRepository();
if (input instanceof RepositoryTreeNode)

Back to the top