diff options
author | Eike Stepper | 2012-10-13 07:32:36 +0000 |
---|---|---|
committer | Eike Stepper | 2012-10-13 07:32:36 +0000 |
commit | 1dee98239e60b3b127b23264a88a6abd3bdf809c (patch) | |
tree | df9dca2198356204903ccbcc00740cf4af621520 | |
parent | 7d24c4db6a723f1949f6636cc357827f16ab2e9a (diff) | |
download | cdo-1dee98239e60b3b127b23264a88a6abd3bdf809c.tar.gz cdo-1dee98239e60b3b127b23264a88a6abd3bdf809c.tar.xz cdo-1dee98239e60b3b127b23264a88a6abd3bdf809c.zip |
[391503] [UI] Render a CDOCommitInfo graph into the history page
https://bugs.eclipse.org/bugs/show_bug.cgi?id=391503
3 files changed, 24 insertions, 4 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/history/Commit.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/history/Commit.java index cd9f517b8e..3176e9e3e4 100644 --- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/history/Commit.java +++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/history/Commit.java @@ -23,6 +23,8 @@ public class Commit private Segment[] rowSegments; + private int commitCounter; + public Commit(CDOCommitInfo commitInfo, Segment segment) { this.segment = segment; @@ -34,6 +36,11 @@ public class Commit return commitInfo; } + public final Net getNet() + { + return segment.getNet(); + } + public final Branch getBranch() { return segment.getBranch(); @@ -51,11 +58,14 @@ public class Commit public final Segment[] getRowSegments() { - // if (rowSegments == null) TODO re-enable cache and add cache invalidation (timestamp of last addition) + Net net = segment.getNet(); + int netCommitCounter = net.getCommitCounter(); + + if (rowSegments == null || commitCounter < netCommitCounter) { long time = getTime(); - Net net = segment.getNet(); rowSegments = net.getRowSegments(time); + commitCounter = netCommitCounter; } return rowSegments; diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/history/Net.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/history/Net.java index 181fe33686..30407f9a96 100644 --- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/history/Net.java +++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/history/Net.java @@ -46,6 +46,8 @@ public class Net private Map<CDOCommitInfo, Commit> commits = new WeakHashMap<CDOCommitInfo, Commit>(); + private int commitCounter; + private Commit firstCommit; private Commit lastCommit; @@ -159,6 +161,7 @@ public class Net { commit = createCommit(commitInfo); commits.put(commitInfo, commit); + ++commitCounter; } return commit; @@ -390,4 +393,9 @@ public class Net throw new IllegalArgumentException("New commits must not be added between the first and last commits"); } + + int getCommitCounter() + { + return commitCounter; + } } diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/history/NetRenderer.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/history/NetRenderer.java index ac5f00eb41..0deb7e10f9 100644 --- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/history/NetRenderer.java +++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/history/NetRenderer.java @@ -174,10 +174,12 @@ public class NetRenderer implements Listener { if (width != 0) { - width += TRACK_OFFSET + 1; + width += 2 * TRACK_OFFSET; } - drawLine(colorDotOutline, width, cellHeightHalf, gc.getClipping().width, cellHeightHalf, LINE_WIDTH); + int y = cellHeightHalf + 1; + int x2 = gc.getClipping().width; + drawLine(colorDotOutline, width, y, x2, y, LINE_WIDTH); } } |