Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2012-10-14 05:56:50 +0000
committerEike Stepper2012-10-14 05:56:50 +0000
commit8baeeeafeb541f21190e7cfa9899904fc0422277 (patch)
treee2c66628c682bd12bff771f02923785b9cba497b /plugins/org.eclipse.emf.cdo.ui
parent8958216346621f13974fb253751a176fbb62ecd3 (diff)
downloadcdo-8baeeeafeb541f21190e7cfa9899904fc0422277.tar.gz
cdo-8baeeeafeb541f21190e7cfa9899904fc0422277.tar.xz
cdo-8baeeeafeb541f21190e7cfa9899904fc0422277.zip
[391503] [UI] Render a CDOCommitInfo graph into the history page
https://bugs.eclipse.org/bugs/show_bug.cgi?id=391503
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.ui')
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/history/Commit.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/history/Net.java52
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/history/Segment.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/history/SegmentList.java20
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/CommitHistoryComposite.java26
5 files changed, 54 insertions, 58 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 3176e9e3e4..fd163a4c7c 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,7 +23,7 @@ public class Commit
private Segment[] rowSegments;
- private int commitCounter;
+ private int commitCounter = -1;
public Commit(CDOCommitInfo commitInfo, Segment segment)
{
@@ -64,7 +64,7 @@ public class Commit
if (rowSegments == null || commitCounter < netCommitCounter)
{
long time = getTime();
- rowSegments = net.getRowSegments(time);
+ rowSegments = net.createRowSegments(time);
commitCounter = netCommitCounter;
}
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 703af68712..54b99168a5 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
@@ -102,30 +102,6 @@ public class Net
return tracks;
}
- public final Segment[] getRowSegments(long time)
- {
- Segment[] segments = NO_SEGMENTS;
- for (int i = tracks.length - 1; i >= 0; --i)
- {
- Track track = tracks[i];
- Segment segment = track.getSegment(time, true);
-
- if (segments == NO_SEGMENTS)
- {
- if (segment == null)
- {
- continue;
- }
-
- segments = new Segment[i + 1];
- }
-
- segments[i] = segment;
- }
-
- return segments;
- }
-
public final Commit getFirstCommit()
{
return firstCommit;
@@ -171,7 +147,7 @@ public class Net
long time = commitInfo.getTimeStamp();
Branch branch = getBranch(cdoBranch);
- Segment segment = branch.getSegment(time, false);
+ Segment segment = branch.getSegment(time);
if (segment == null)
{
@@ -343,6 +319,30 @@ public class Net
throw new IllegalArgumentException("New commits must not be added between the first and last commits");
}
+ Segment[] createRowSegments(long time)
+ {
+ Segment[] segments = NO_SEGMENTS;
+ for (int i = tracks.length - 1; i >= 0; --i)
+ {
+ Track track = tracks[i];
+ Segment segment = track.getSegment(time);
+
+ if (segments == NO_SEGMENTS)
+ {
+ if (segment == null)
+ {
+ continue;
+ }
+
+ segments = new Segment[i + 1];
+ }
+
+ segments[i] = segment;
+ }
+
+ return segments;
+ }
+
Commit addCommit(CDOCommitInfo commitInfo)
{
Segment segment = getSegment(commitInfo);
@@ -351,6 +351,7 @@ public class Net
throw new IllegalStateException("No segment");
}
+ ++commitCounter;
Commit commit = new Commit(commitInfo, segment);
if (firstCommit == null)
@@ -372,7 +373,6 @@ public class Net
}
commits.put(commitInfo, commit);
- ++commitCounter;
return commit;
}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/history/Segment.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/history/Segment.java
index 22a0b2f8bb..fa4635d0b7 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/history/Segment.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/history/Segment.java
@@ -124,11 +124,7 @@ public class Segment
void adjustCommitTimes(long time)
{
- if (firstVisualTime == 0)
- {
- firstVisualTime = time;
- }
-
+ adjustVisualTime(time, false);
if (firstCommitTime == 0)
{
firstCommitTime = time;
@@ -137,10 +133,6 @@ public class Segment
else if (time < firstCommitTime)
{
firstCommitTime = time;
- if (time < firstVisualTime)
- {
- firstVisualTime = time;
- }
}
else if (time > lastCommitTime)
{
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/history/SegmentList.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/history/SegmentList.java
index a67d3aa186..78fe0e879a 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/history/SegmentList.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/history/SegmentList.java
@@ -41,9 +41,8 @@ public abstract class SegmentList
return lastSegment;
}
- public final Segment getSegment(long time, boolean extendIfPossible)
+ public final Segment getSegment(long time)
{
- Segment last = null;
Segment segment = lastSegment;
while (segment != null)
{
@@ -52,26 +51,9 @@ public abstract class SegmentList
return segment;
}
- last = segment;
segment = getPreviousSegment(segment);
}
- if (extendIfPossible)
- {
- if (last != null && last.getLastCommitTime() >= time)
- {
- if (last.getBranch().getFirstCommitTime() <= time)
- {
- Segment previousInTrack = last.getPreviousInTrack();
- if (previousInTrack == null || previousInTrack.getLastCommitTime() < time)
- {
- last.adjustCommitTimes(time);
- return last;
- }
- }
- }
- }
-
return null;
}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/CommitHistoryComposite.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/CommitHistoryComposite.java
index 1d65d31ad7..9fab18e7cc 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/CommitHistoryComposite.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/CommitHistoryComposite.java
@@ -18,6 +18,7 @@ import org.eclipse.emf.cdo.common.commit.CDOCommitHistory.TriggerLoadElement;
import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
import org.eclipse.emf.cdo.common.commit.CDOCommitInfoHandler;
import org.eclipse.emf.cdo.common.commit.CDOCommitInfoManager;
+import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
import org.eclipse.emf.cdo.internal.ui.history.NetRenderer;
import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.ui.shared.SharedIcons;
@@ -101,6 +102,11 @@ public class CommitHistoryComposite extends Composite
return tableViewer;
}
+ public final LabelProvider getLabelProvider()
+ {
+ return labelProvider;
+ }
+
public final Input getInput()
{
return input;
@@ -145,7 +151,7 @@ public class CommitHistoryComposite extends Composite
{
netRenderer.setInput(input);
CDOCommitInfo[] elements = history.getElements();
- for (int i = elements.length - 1; i >= 0; --i)
+ for (int i = 0; i < elements.length; i++)
{
CDOCommitInfo commitInfo = elements[i];
netRenderer.addCommit(commitInfo);
@@ -477,6 +483,8 @@ public class CommitHistoryComposite extends Composite
private CDOBranch inputBranch;
+ private boolean formatTimeStamps = true;
+
public LabelProvider()
{
addColumn(new Column<CDOCommitInfo>("Time", 160)
@@ -489,7 +497,11 @@ public class CommitHistoryComposite extends Composite
return StringUtil.EMPTY;
}
- // return CDOCommonUtil.formatTimeStamp(commitInfo.getTimeStamp());
+ if (formatTimeStamps)
+ {
+ return CDOCommonUtil.formatTimeStamp(commitInfo.getTimeStamp());
+ }
+
return "" + commitInfo.getTimeStamp();
}
@@ -600,5 +612,15 @@ public class CommitHistoryComposite extends Composite
{
this.inputBranch = inputBranch;
}
+
+ public boolean isFormatTimeStamps()
+ {
+ return formatTimeStamps;
+ }
+
+ public void setFormatTimeStamps(boolean formatTimeStamps)
+ {
+ this.formatTimeStamps = formatTimeStamps;
+ }
}
}

Back to the top