Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2015-07-20 17:47:22 +0000
committerEike Stepper2015-07-20 17:47:22 +0000
commit60476414f3b097bdb93f1c0a40641210a0bce51c (patch)
tree1015e8d42cefd8bd4916f62cea053f07b9db3a00 /plugins/org.eclipse.emf.cdo.explorer.ui
parent9d9be353db2164fd15374d53173000c860736e81 (diff)
downloadcdo-60476414f3b097bdb93f1c0a40641210a0bce51c.tar.gz
cdo-60476414f3b097bdb93f1c0a40641210a0bce51c.tar.xz
cdo-60476414f3b097bdb93f1c0a40641210a0bce51c.zip
[473103] Only offer optional compare or history functionality if that's available
https://bugs.eclipse.org/bugs/show_bug.cgi?id=473103
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.explorer.ui')
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/plugin.xml2
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOCheckoutDropAdapterAssistant.java22
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/actions/CompareWithActionProvider.java12
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/actions/MergeFromActionProvider.java12
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/actions/ShowInActionProvider.java26
5 files changed, 53 insertions, 21 deletions
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/plugin.xml b/plugins/org.eclipse.emf.cdo.explorer.ui/plugin.xml
index 9c7421de07..e2270a07c4 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/plugin.xml
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/plugin.xml
@@ -317,6 +317,7 @@
<and>
<instanceof value="org.eclipse.emf.cdo.explorer.checkouts.CDOCheckout"/>
<test property="org.eclipse.emf.cdo.explorer.checkout.state" value="Open"/>
+ <test property="org.eclipse.emf.cdo.ui.support.compare" value="true"/>
</and>
</enablement>
</actionProvider>
@@ -327,6 +328,7 @@
<and>
<instanceof value="org.eclipse.emf.cdo.explorer.checkouts.CDOCheckout"/>
<test property="org.eclipse.emf.cdo.explorer.checkout.state" value="Open"/>
+ <test property="org.eclipse.emf.cdo.ui.support.compare" value="true"/>
</and>
</enablement>
</actionProvider>
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 fc62ec3e00..7f4014259f 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
@@ -27,6 +27,7 @@ import org.eclipse.emf.cdo.explorer.ui.checkouts.actions.ReplaceWithActionProvid
import org.eclipse.emf.cdo.explorer.ui.checkouts.actions.SwitchToActionProvider;
import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.ui.Support;
import org.eclipse.emf.cdo.util.CDOUtil;
import org.eclipse.net4j.util.AdapterUtil;
@@ -68,6 +69,8 @@ import java.util.Set;
*/
public class CDOCheckoutDropAdapterAssistant extends CommonDropAdapterAssistant
{
+ private static final boolean COMPARE_SUPPORT_AVAILABLE = Support.COMPARE.isAvailable();
+
private static final EObject[] NO_OBJECTS = {};
public CDOCheckoutDropAdapterAssistant()
@@ -96,13 +99,16 @@ public class CDOCheckoutDropAdapterAssistant extends CommonDropAdapterAssistant
return Status.OK_STATUS;
}
}
- else if (dropOperation == DND.DROP_COPY)
- {
- return Status.OK_STATUS;
- }
- else if (dropOperation == DND.DROP_LINK)
+ else
{
- return Status.OK_STATUS;
+ if (dropOperation == DND.DROP_COPY && COMPARE_SUPPORT_AVAILABLE)
+ {
+ return Status.OK_STATUS;
+ }
+ else if (dropOperation == DND.DROP_LINK && COMPARE_SUPPORT_AVAILABLE)
+ {
+ return Status.OK_STATUS;
+ }
}
return Status.CANCEL_STATUS;
@@ -156,11 +162,11 @@ public class CDOCheckoutDropAdapterAssistant extends CommonDropAdapterAssistant
}
}
}
- else if (dropOperation == DND.DROP_COPY)
+ else if (dropOperation == DND.DROP_COPY && COMPARE_SUPPORT_AVAILABLE)
{
MergeFromActionProvider.mergeFrom(checkout, branchPoint);
}
- else if (dropOperation == DND.DROP_LINK)
+ else if (dropOperation == DND.DROP_LINK && COMPARE_SUPPORT_AVAILABLE)
{
CompareWithActionProvider.compareWith(checkout, branchPoint);
}
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/actions/CompareWithActionProvider.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/actions/CompareWithActionProvider.java
index 70fc1e2a5e..b9d1cd851b 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/actions/CompareWithActionProvider.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/actions/CompareWithActionProvider.java
@@ -13,6 +13,7 @@ package org.eclipse.emf.cdo.explorer.ui.checkouts.actions;
import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
import org.eclipse.emf.cdo.explorer.checkouts.CDOCheckout;
import org.eclipse.emf.cdo.explorer.repositories.CDORepository;
+import org.eclipse.emf.cdo.ui.Support;
import org.eclipse.emf.cdo.ui.compare.CDOCompareEditorUtil;
/**
@@ -59,9 +60,12 @@ public class CompareWithActionProvider extends AbstractBranchPointActionProvider
public static void compareWith(CDOCheckout checkout, CDOBranchPoint branchPoint)
{
- CDORepository repository = checkout.getRepository();
- CDOBranchPoint left = branchPoint;
- CDOBranchPoint right = checkout.getBranchPoint();
- CDOCompareEditorUtil.openEditor(repository, left, right, null, true);
+ if (Support.COMPARE.isAvailable())
+ {
+ CDORepository repository = checkout.getRepository();
+ CDOBranchPoint left = branchPoint;
+ CDOBranchPoint right = checkout.getBranchPoint();
+ CDOCompareEditorUtil.openEditor(repository, left, right, null, true);
+ }
}
}
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/actions/MergeFromActionProvider.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/actions/MergeFromActionProvider.java
index efcc49b88e..7f877147b0 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/actions/MergeFromActionProvider.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/actions/MergeFromActionProvider.java
@@ -13,6 +13,7 @@ package org.eclipse.emf.cdo.explorer.ui.checkouts.actions;
import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
import org.eclipse.emf.cdo.explorer.checkouts.CDOCheckout;
import org.eclipse.emf.cdo.explorer.repositories.CDORepository;
+import org.eclipse.emf.cdo.ui.Support;
import org.eclipse.emf.cdo.ui.compare.CDOCompareEditorUtil;
/**
@@ -59,9 +60,12 @@ public class MergeFromActionProvider extends AbstractBranchPointActionProvider
public static void mergeFrom(CDOCheckout checkout, CDOBranchPoint branchPoint)
{
- CDORepository repository = checkout.getRepository();
- CDOBranchPoint left = branchPoint;
- CDOBranchPoint right = checkout.getBranchPoint();
- CDOCompareEditorUtil.openEditor(repository, repository, left, right, null, true);
+ if (Support.COMPARE.isAvailable())
+ {
+ CDORepository repository = checkout.getRepository();
+ CDOBranchPoint left = branchPoint;
+ CDOBranchPoint right = checkout.getBranchPoint();
+ CDOCompareEditorUtil.openEditor(repository, repository, left, right, null, true);
+ }
}
}
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/actions/ShowInActionProvider.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/actions/ShowInActionProvider.java
index 1352f0f375..aa320ad15a 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/actions/ShowInActionProvider.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/actions/ShowInActionProvider.java
@@ -30,6 +30,7 @@ import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.spi.common.branch.CDOBranchUtil;
import org.eclipse.emf.cdo.spi.workspace.InternalCDOWorkspace;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.ui.Support;
import org.eclipse.emf.cdo.ui.internal.team.history.CDOHistoryAdapterFactory;
import org.eclipse.emf.cdo.ui.shared.SharedIcons;
import org.eclipse.emf.cdo.util.CDOUtil;
@@ -82,6 +83,8 @@ public class ShowInActionProvider extends AbstractActionProvider<Object>
private static final String ID = ShowInActionProvider.class.getName();
+ private static final boolean HISTORY_SUPPORT_AVAILABLE = Support.HISTORY.isAvailable();
+
private static final String DASHBOARD_KEY = CDOCheckoutDashboard.class.getName();
public ShowInActionProvider()
@@ -129,7 +132,11 @@ public class ShowInActionProvider extends AbstractActionProvider<Object>
}
filled |= addAction(menu, repository, new ShowInSessionsViewAction(page, repository, null));
- filled |= addAction(menu, repository.getSession(), new ShowInHistoryAction(page, repository.getSession()));
+
+ if (HISTORY_SUPPORT_AVAILABLE)
+ {
+ filled |= addAction(menu, repository.getSession(), new ShowInHistoryAction(page, repository.getSession()));
+ }
}
else
{
@@ -145,7 +152,10 @@ public class ShowInActionProvider extends AbstractActionProvider<Object>
if (selectedElement instanceof CDOBranch)
{
- filled |= addAction(menu, selectedElement, new ShowInHistoryAction(page, selectedElement));
+ if (HISTORY_SUPPORT_AVAILABLE)
+ {
+ filled |= addAction(menu, selectedElement, new ShowInHistoryAction(page, selectedElement));
+ }
}
if (selectedElement instanceof CDOCheckout)
@@ -182,7 +192,10 @@ public class ShowInActionProvider extends AbstractActionProvider<Object>
filled |= addAction(menu, checkout, new ShowInViewAction(page, CDOTimeMachineView.ID));
}
- filled |= addAction(menu, checkout.getView(), new ShowInHistoryAction(page, checkout.getView()));
+ if (HISTORY_SUPPORT_AVAILABLE)
+ {
+ filled |= addAction(menu, checkout.getView(), new ShowInHistoryAction(page, checkout.getView()));
+ }
}
}
@@ -191,7 +204,10 @@ public class ShowInActionProvider extends AbstractActionProvider<Object>
EObject eObject = (EObject)selectedElement;
if (CDOExplorerUtil.getCheckout(eObject) != null)
{
- filled |= addAction(menu, eObject, new ShowInHistoryAction(page, eObject));
+ if (HISTORY_SUPPORT_AVAILABLE)
+ {
+ filled |= addAction(menu, eObject, new ShowInHistoryAction(page, eObject));
+ }
}
}
@@ -451,7 +467,7 @@ public class ShowInActionProvider extends AbstractActionProvider<Object>
@Override
protected void run(IViewPart viewPart) throws Exception
{
- if (selectedElement != null)
+ if (selectedElement != null && HISTORY_SUPPORT_AVAILABLE)
{
CDOHistoryAdapterFactory.load();
((IHistoryView)viewPart).showHistoryFor(selectedElement);

Back to the top