diff options
author | Eike Stepper | 2015-02-28 19:32:43 +0000 |
---|---|---|
committer | Eike Stepper | 2015-02-28 19:32:43 +0000 |
commit | 07d6b27f8f7255780603bc0b27caef8c53dbe1d9 (patch) | |
tree | e1971d96266fcc9899e57873f803ff2b49d89afb | |
parent | 070ee454f30e9499779a108e0f32053645dfa58e (diff) | |
download | cdo-07d6b27f8f7255780603bc0b27caef8c53dbe1d9.tar.gz cdo-07d6b27f8f7255780603bc0b27caef8c53dbe1d9.tar.xz cdo-07d6b27f8f7255780603bc0b27caef8c53dbe1d9.zip |
[458349] Consolidate UI
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=458349
4 files changed, 52 insertions, 31 deletions
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOCheckoutDropAdapterAssistant.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOCheckoutDropAdapterAssistant.java index 69ce2b3ea0..99a612e1b9 100644 --- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOCheckoutDropAdapterAssistant.java +++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOCheckoutDropAdapterAssistant.java @@ -177,8 +177,16 @@ public class CDOCheckoutDropAdapterAssistant extends CommonDropAdapterAssistant element = repository.getSession().getBranchManager().getMainBranch(); } } - - if (element instanceof CDOBranch) + else if (element instanceof CDOCheckout) + { + CDOCheckout otherCheckout = (CDOCheckout)element; + CDOBranchPoint branchPoint = checkout.getBranchPoint(otherCheckout); + if (branchPoint != null) + { + element = branchPoint; + } + } + else if (element instanceof CDOBranch) { CDOBranch branch = (CDOBranch)element; element = branch.getHead(); diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/actions/AbstractBranchPointActionProvider.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/actions/AbstractBranchPointActionProvider.java index 97ab8bf7bc..1ef75145f8 100644 --- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/actions/AbstractBranchPointActionProvider.java +++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/actions/AbstractBranchPointActionProvider.java @@ -10,8 +10,6 @@ */ package org.eclipse.emf.cdo.explorer.ui.checkouts.actions; -import org.eclipse.emf.cdo.common.branch.CDOBranch; -import org.eclipse.emf.cdo.common.branch.CDOBranchManager; import org.eclipse.emf.cdo.common.branch.CDOBranchPoint; import org.eclipse.emf.cdo.common.commit.CDOCommitInfo; import org.eclipse.emf.cdo.common.util.CDOCommonUtil; @@ -71,9 +69,10 @@ public abstract class AbstractBranchPointActionProvider extends AbstractActionPr CDOBranchPoint checkoutBranchPoint = checkout.getBranchPoint(); // Repository of offline checkout is not necessarily open. - if (checkout.getRepository().isConnected()) + CDORepository repository = checkout.getRepository(); + if (repository.isConnected()) { - subMenu.add(new Separator("historized")); + subMenu.add(new Separator("history")); for (CDOBranchPoint branchPoint : checkout.getBranchPoints()) { if (!ObjectUtil.equals(branchPoint, checkoutBranchPoint)) @@ -81,33 +80,35 @@ public abstract class AbstractBranchPointActionProvider extends AbstractActionPr subMenu.add(new HistorizedBranchPointAction(page, checkout, branchPoint)); } } - } - subMenu.add(new Separator("dialogs")); - subMenu.add(new OtherBranchPointAction(page, checkout, false)); - subMenu.add(new OtherBranchPointAction(page, checkout, true)); - subMenu.add(new CommitBranchPointAction(page, checkout)); + subMenu.add(new Separator("other")); + subMenu.add(new OtherBranchPointAction(page, checkout, false)); + subMenu.add(new OtherBranchPointAction(page, checkout, true)); - subMenu.add(new Separator("checkouts")); - for (CDOCheckout otherCheckout : CDOExplorerUtil.getCheckoutManager().getCheckouts()) - { - if (otherCheckout == checkout) - { - continue; - } + subMenu.add(new Separator("commit")); + subMenu.add(new CommitBranchPointAction(page, checkout)); - if (otherCheckout.getRepository() != checkout.getRepository()) + subMenu.add(new Separator("checkout")); + for (CDOCheckout otherCheckout : CDOExplorerUtil.getCheckoutManager().getCheckouts()) { - continue; - } + if (otherCheckout == checkout) + { + continue; + } - if (otherCheckout.getBranchID() == checkout.getBranchID() - && otherCheckout.getTimeStamp() == checkout.getTimeStamp()) - { - continue; - } + if (otherCheckout.getRepository() != repository) + { + continue; + } + + if (otherCheckout.getBranchID() == checkout.getBranchID() + && otherCheckout.getTimeStamp() == checkout.getTimeStamp()) + { + continue; + } - subMenu.add(new OtherCheckoutAction(page, checkout, otherCheckout)); + subMenu.add(new OtherCheckoutAction(page, checkout, otherCheckout)); + } } } @@ -271,10 +272,7 @@ public abstract class AbstractBranchPointActionProvider extends AbstractActionPr { super(page); this.checkout = checkout; - - CDOBranchManager branchManager = checkout.getView().getSession().getBranchManager(); - CDOBranch branch = branchManager.getBranch(otherCheckout.getBranchID()); - branchPoint = branch.getPoint(otherCheckout.getTimeStamp()); + branchPoint = checkout.getBranchPoint(otherCheckout); String text = otherCheckout.getLabel() + " - " + branchPoint.getBranch().getPathName(); 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 4124ff8b9d..223c5b6798 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 @@ -57,6 +57,8 @@ public interface CDOCheckout extends CDOExplorerElement, CDOTimeProvider, StateP public void setBranchPoint(int branchID, long timeStamp); + public CDOBranchPoint getBranchPoint(CDOCheckout fromCheckout); + public CDOBranchPoint[] getBranchPoints(); public boolean addBranchPoint(CDOBranchPoint branchPoint); 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 4ad799a93d..76e36c36a5 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 @@ -178,6 +178,19 @@ public abstract class CDOCheckoutImpl extends AbstractElement implements CDOChec } } + public final CDOBranchPoint getBranchPoint(CDOCheckout fromCheckout) + { + if (repository == fromCheckout.getRepository() && repository.isConnected()) + { + + CDOBranchManager branchManager = repository.getSession().getBranchManager(); + CDOBranch branch = branchManager.getBranch(fromCheckout.getBranchID()); + return branch.getPoint(fromCheckout.getTimeStamp()); + } + + return null; + } + protected String doSetBranchPoint(int branchID, long timeStamp) { CDOBranch branch = view.getSession().getBranchManager().getBranch(branchID); |