diff options
author | Eike Stepper | 2016-10-10 13:59:36 +0000 |
---|---|---|
committer | Eike Stepper | 2016-10-10 13:59:36 +0000 |
commit | 7f9f9a8c0e7ef4820d5b7bb98d153426725b326a (patch) | |
tree | 605071ab58641448ea68c8d27b8b94497599dda7 /plugins | |
parent | ef07d64d87b6151eca6f2fcad357b5d38050a043 (diff) | |
download | cdo-7f9f9a8c0e7ef4820d5b7bb98d153426725b326a.tar.gz cdo-7f9f9a8c0e7ef4820d5b7bb98d153426725b326a.tar.xz cdo-7f9f9a8c0e7ef4820d5b7bb98d153426725b326a.zip |
[504014] Make merge information available in CDOCommitInfo
https://bugs.eclipse.org/bugs/show_bug.cgi?id=504014
Diffstat (limited to 'plugins')
6 files changed, 52 insertions, 16 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui.team/src/org/eclipse/emf/cdo/ui/internal/team/history/CDOHistoryPage.java b/plugins/org.eclipse.emf.cdo.ui.team/src/org/eclipse/emf/cdo/ui/internal/team/history/CDOHistoryPage.java index e198004d9e..361fd23dab 100644 --- a/plugins/org.eclipse.emf.cdo.ui.team/src/org/eclipse/emf/cdo/ui/internal/team/history/CDOHistoryPage.java +++ b/plugins/org.eclipse.emf.cdo.ui.team/src/org/eclipse/emf/cdo/ui/internal/team/history/CDOHistoryPage.java @@ -21,6 +21,7 @@ import org.eclipse.emf.cdo.internal.ui.history.NetRenderer; import org.eclipse.emf.cdo.internal.ui.history.Track; import org.eclipse.emf.cdo.session.CDOSession; import org.eclipse.emf.cdo.spi.common.branch.CDOBranchUtil; +import org.eclipse.emf.cdo.transaction.CDOMerger; import org.eclipse.emf.cdo.transaction.CDOTransaction; import org.eclipse.emf.cdo.ui.widgets.CommitHistoryComposite; import org.eclipse.emf.cdo.ui.widgets.CommitHistoryComposite.Input; @@ -61,7 +62,9 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Menu; import org.eclipse.team.ui.history.HistoryPage; import org.eclipse.ui.IActionBars; +import org.eclipse.ui.ISharedImages; import org.eclipse.ui.IWorkbenchActionConstants; +import org.eclipse.ui.PlatformUI; import org.eclipse.ui.part.IPageSite; /** @@ -96,7 +99,10 @@ public class CDOHistoryPage extends HistoryPage { public void run() { - CDOHistoryPage.this.setInput(null); + if (!commitHistoryComposite.isDisposed()) + { + CDOHistoryPage.this.setInput(null); + } } }); } @@ -166,7 +172,7 @@ public class CDOHistoryPage extends HistoryPage new ViewerDropAdapter(tableViewer) { { - // We don't want it to look like you can insert new elements, only drop onto existing elements + // We don't want it to look like you can insert new elements, only drop onto existing elements. setFeedbackEnabled(false); } @@ -202,7 +208,8 @@ public class CDOHistoryPage extends HistoryPage @Override protected void run(CDOTransaction transaction) { - transaction.merge(objectToDrop, new DefaultCDOMerger.PerFeature.ManyValued()); + CDOMerger merger = new DefaultCDOMerger.PerFeature.ManyValued(); + transaction.merge(objectToDrop, merger); } }.execute(dropTarget); @@ -320,7 +327,7 @@ public class CDOHistoryPage extends HistoryPage { if (DEBUG) { - manager.add(new Action("DEBUG", IAction.AS_PUSH_BUTTON) + Action action = new Action("DEBUG", IAction.AS_PUSH_BUTTON) { @SuppressWarnings("unused") @Override @@ -334,7 +341,11 @@ public class CDOHistoryPage extends HistoryPage CDOSession session = net.getSession(); System.out.println("Debug " + net); // Set a breakpoint on this line to inspect the net. } - }); + }; + + ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages(); + action.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK)); + manager.add(action); } } diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/history/Branch.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/history/Branch.java index 82a9818012..e108490802 100644 --- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/history/Branch.java +++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/history/Branch.java @@ -177,6 +177,7 @@ public final class Branch extends SegmentList CDOCommitInfoManager commitInfoManager = getNet().getSession().getCommitInfoManager(); CDOCommitInfo commitInfo = commitInfoManager.getBaseOfBranch(cdoBranch); + baseCommitBranch = getNet().getBranch(commitInfo.getBranch()); baseCommitTime = commitInfo.getTimeStamp(); } 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 fab90ad52e..f15276c0ab 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 @@ -217,7 +217,7 @@ public class Net Segment lastSegment = track.getLastSegment(); if (lastSegment != null) { - if (lastSegment.getBranch() == branch) + if (lastSegment.getBranch() == branch && !lastSegment.isMerge()) { // If the last segment of this track has the same branch, then just extend it return lastSegment; @@ -260,7 +260,7 @@ public class Net if (firstSegment != null) { Branch firstBranch = firstSegment.getBranch(); - if (firstBranch == branch) + if (firstBranch == branch && !firstSegment.isMerge()) { // If the first segment of this track has the same branch, then just extend it return firstSegment; 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 3407d77ca2..3f4650236d 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 @@ -271,15 +271,16 @@ public final class NetRenderer implements Listener private int drawCommit(CDOCommitInfo commitInfo, boolean justMeasureWidth) { Commit commit = net.getOrAddCommit(commitInfo); + Branch commitBranch = commit.getBranch(); Segment[] segments = commit.getRowSegments(); Segment commitSegment = commit.getSegment(); long commitTime = commit.getTime(); - boolean commitLastInBranch = commitTime == commitSegment.getLastCommitTime(); + boolean commitLastInBranch = commitTime == commitBranch.getLastCommitTime(); if (!justMeasureWidth) { Track commitTrack = commitSegment.getTrack(); - Color commitColor = commitSegment.getBranch().getColor(); + Color commitColor = commitBranch.getColor(); int commitTrackPosition = commitTrack.getPosition(); int commitTrackCenter = getTrackCenter(commitTrackPosition); 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 58d0e01a01..e19fb042c9 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 @@ -125,22 +125,45 @@ public final class Segment return "Segment[" + branch + " --> " + track + "]"; } - void adjustVisualTime(long time, boolean complete) + void adjustVisualTime(long time, boolean adjustComplete) { if (isMerge()) { firstVisualTime = firstCommitTime; - this.complete = true; + complete = true; + return; } - else + + if (time < firstVisualTime) + { + firstVisualTime = time; + } + else if (firstVisualTime == 0) { - if (firstVisualTime == 0 || time < firstVisualTime) + Segment previousInBranch = getPreviousInBranch(); + if (previousInBranch != null) { - firstVisualTime = time; + firstVisualTime = previousInBranch.getLastCommitTime(); + complete = true; + return; } + + Commit firstCommit = getNet().getFirstCommit(); + if (firstCommit != null) + { + long baseCommitTime = branch.getBaseCommitTime(); + if (baseCommitTime >= firstCommit.getTime()) + { + firstVisualTime = baseCommitTime; + complete = true; + return; + } + } + + firstVisualTime = time; } - this.complete |= complete; + complete |= adjustComplete; } void adjustCommitTimes(long time) 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 58c544ba42..e7a5152b27 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 @@ -728,7 +728,7 @@ public class CommitHistoryComposite extends Composite } }); - addColumn(new Column<CDOCommitInfo>("Merge Source", 160) + addColumn(new Column<CDOCommitInfo>("Merge", 160) { @Override public String getText(CDOCommitInfo commitInfo) |