From 82d8d5d03b3c29e8140d9df876657a1c5147b70a Mon Sep 17 00:00:00 2001 From: Robin Rosenberg Date: Thu, 23 Aug 2007 22:34:20 +0200 Subject: [PATCH] Mark HEAD with a big dot and pack the graphics slightly. Signed-off-by: Robin Rosenberg --- .../src/org/spearce/egit/ui/GitHistoryPage.java | 33 ++++++++++++++++++---- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/GitHistoryPage.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/GitHistoryPage.java index 190bced7..418dbb4c 100644 --- a/org.spearce.egit.ui/src/org/spearce/egit/ui/GitHistoryPage.java +++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/GitHistoryPage.java @@ -439,13 +439,13 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable, System.out.println(event); GitFileRevision element = (GitFileRevision)item.getData(); ObjectId xx = element.getCommitId(); - int x = event.x; + final int DOTRADIUS = 3; + final int INTERLANE = 8; + int x = event.x + INTERLANE/2 + 2; int y = event.y; int h = event.height; event.gc.setLineWidth(2); // RepositoryMapping rm = RepositoryMapping.getMapping(element.getResource()); - final int DOTRADIUS = 3; - final int INTERLANE = 10; Lane lane = element.getLane(); TopologicalSorter counter = lane.getSorter(); @@ -529,8 +529,12 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable, } } } - event.gc.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK)); - event.gc.fillOval(x + lane.getNumber() * INTERLANE - DOTRADIUS, y + h/2 - DOTRADIUS, DOTRADIUS*2, DOTRADIUS*2); + if (xx.equals(currentHead)) { + event.gc.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_RED)); + event.gc.fillOval(x + lane.getNumber() * INTERLANE - DOTRADIUS*2, y + h/2 - DOTRADIUS*2, DOTRADIUS*4, DOTRADIUS*4); + } else + event.gc.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK)); + event.gc.fillOval(x + lane.getNumber() * INTERLANE - DOTRADIUS, y + h/2 - DOTRADIUS, DOTRADIUS*2, DOTRADIUS*2); } } }); @@ -549,6 +553,7 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable, } private Map appliedPatches; + ObjectId currentHead; private Map tags; private Map branches; GitHistoryLabelProvider lp = new GitHistoryLabelProvider(); @@ -593,6 +598,12 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable, // TODO Auto-generated catch block e.printStackTrace(); } + try { + currentHead = repositoryMapping.getRepository().resolve("HEAD"); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } Map newBranches = new HashMap(); try { for (String branch : repositoryMapping.getRepository().getBranches()) { @@ -609,12 +620,22 @@ public class GitHistoryPage extends HistoryPage implements IAdaptable, } newBranches.put(id, samecommit); } + String[] samecommit = newBranches.get(currentHead); + if (samecommit == null) { + samecommit = new String[] { "HEAD" }; + } else { + String[] n=new String[samecommit.length + 1]; + for (int j=0; j