diff options
author | Eike Stepper | 2015-02-21 15:18:04 +0000 |
---|---|---|
committer | Eike Stepper | 2015-02-21 16:49:58 +0000 |
commit | a0c08ad3bd3a26ebfd86682465fb8759046a6ca6 (patch) | |
tree | a9b562cfd22c7e5ee0bbc0308de11492eee2ec9e /plugins/org.eclipse.emf.cdo.explorer/src | |
parent | 39354c367bba7df8b5c993b2462e495c4def1e28 (diff) | |
download | cdo-a0c08ad3bd3a26ebfd86682465fb8759046a6ca6.tar.gz cdo-a0c08ad3bd3a26ebfd86682465fb8759046a6ca6.tar.xz cdo-a0c08ad3bd3a26ebfd86682465fb8759046a6ca6.zip |
[458349] Consolidate UI
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=458349
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.explorer/src')
3 files changed, 56 insertions, 6 deletions
diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/checkouts/CDOCheckout.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/checkouts/CDOCheckout.java index c3a18b7362..f4470b2328 100644 --- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/checkouts/CDOCheckout.java +++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/checkouts/CDOCheckout.java @@ -43,6 +43,8 @@ public interface CDOCheckout extends CDOExplorerElement, CDOTimeProvider, StateP public CDORepository getRepository(); + public void setBranchPoint(int branchID, long timeStamp); + public int getBranchID(); public void setBranchID(int branchID); diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutImpl.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutImpl.java index 6c6e1aa747..406a78ae39 100644 --- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutImpl.java +++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutImpl.java @@ -11,6 +11,7 @@ package org.eclipse.emf.cdo.internal.explorer.checkouts; import org.eclipse.emf.cdo.common.branch.CDOBranch; +import org.eclipse.emf.cdo.common.branch.CDOBranchPoint; import org.eclipse.emf.cdo.common.id.CDOID; import org.eclipse.emf.cdo.common.id.CDOIDUtil; import org.eclipse.emf.cdo.explorer.checkouts.CDOCheckout; @@ -114,9 +115,33 @@ public abstract class CDOCheckoutImpl extends AbstractElement implements CDOChec return branchID; } + public final void setBranchPoint(int branchID, long timeStamp) + { + if (this.branchID != branchID || this.timeStamp != timeStamp) + { + this.branchID = branchID; + this.timeStamp = timeStamp; + + if (isOpen()) + { + CDOBranch branch = view.getSession().getBranchManager().getBranch(branchID); + CDOBranchPoint branchPoint = branch.getPoint(timeStamp); + view.setBranchPoint(branchPoint); + + branchPath = branch.getPathName(); + } + else + { + branchPath = null; + } + + save(); + } + } + public final void setBranchID(int branchID) { - this.branchID = branchID; + setBranchPoint(branchID, timeStamp); } public String getBranchPath() @@ -140,7 +165,7 @@ public abstract class CDOCheckoutImpl extends AbstractElement implements CDOChec public final void setTimeStamp(long timeStamp) { - this.timeStamp = timeStamp; + setBranchPoint(branchID, timeStamp); } public final boolean isReadOnly() diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/OnlineCDOCheckout.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/OnlineCDOCheckout.java index b9a6c5c8bd..cafff801f6 100644 --- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/OnlineCDOCheckout.java +++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/OnlineCDOCheckout.java @@ -15,6 +15,10 @@ import org.eclipse.emf.cdo.common.branch.CDOBranch; import org.eclipse.emf.cdo.common.branch.CDOBranchManager; import org.eclipse.emf.cdo.session.CDOSession; import org.eclipse.emf.cdo.view.CDOView; +import org.eclipse.emf.cdo.view.CDOViewTargetChangedEvent; + +import org.eclipse.net4j.util.event.IEvent; +import org.eclipse.net4j.util.event.IListener; /** * @author Eike Stepper @@ -69,12 +73,31 @@ public class OnlineCDOCheckout extends CDOCheckoutImpl CDOBranch branch = branchManager.getBranch(getBranchID()); setBranchPath(branch.getPathName()); - if (isReadOnly()) + CDOView view = openView(session, branch); + view.addListener(new IListener() { - return session.openView(branch, getTimeStamp()); - } + public void notifyEvent(IEvent event) + { + if (event instanceof CDOViewTargetChangedEvent) + { + getManager().fireElementChangedEvent(true, OnlineCDOCheckout.this); + } + } + }); + + return view; + } + + private CDOView openView(CDOSession session, CDOBranch branch) + { + return session.openView(branch, getTimeStamp()); - return session.openTransaction(branch); + // if (isReadOnly()) + // { + // return session.openView(branch, getTimeStamp()); + // } + // + // return session.openTransaction(branch); } @Override |