Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2015-07-27 06:42:56 -0400
committerEike Stepper2015-07-27 06:42:56 -0400
commit84522d2039d55db41923ee4d5040d5b435e2e6d0 (patch)
tree6c19ba98482986eaffd2a182bc1b87d6aeb2bc4f /plugins/org.eclipse.emf.cdo.explorer
parentcd97c1bd00b002e29abc182e744b2f1ddf708bd1 (diff)
downloadcdo-84522d2039d55db41923ee4d5040d5b435e2e6d0.tar.gz
cdo-84522d2039d55db41923ee4d5040d5b435e2e6d0.tar.xz
cdo-84522d2039d55db41923ee4d5040d5b435e2e6d0.zip
[458349] Consolidate UI - Hide edit commands on read-only checkouts / checkout state synchronization
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=458349
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.explorer')
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/plugin.xml8
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutObjectProperties.java78
2 files changed, 83 insertions, 3 deletions
diff --git a/plugins/org.eclipse.emf.cdo.explorer/plugin.xml b/plugins/org.eclipse.emf.cdo.explorer/plugin.xml
index 5177eb8a6a..a1b4b19133 100644
--- a/plugins/org.eclipse.emf.cdo.explorer/plugin.xml
+++ b/plugins/org.eclipse.emf.cdo.explorer/plugin.xml
@@ -44,8 +44,14 @@
id="org.eclipse.emf.cdo.explorer.object.properties"
type="org.eclipse.emf.ecore.EObject"
namespace="org.eclipse.emf.cdo.explorer.object"
- properties="inCheckout"
+ properties="inCheckout,stateCheckout,openCheckout,typeCheckout,readOnlyCheckout"
class="org.eclipse.emf.cdo.internal.explorer.checkouts.CDOCheckoutObjectProperties$Tester"/>
+ <propertyTester
+ id="org.eclipse.emf.cdo.explorer.element.properties"
+ type="org.eclipse.emf.cdo.CDOElement"
+ namespace="org.eclipse.emf.cdo.explorer.object"
+ properties="inCheckout,stateCheckout,openCheckout,typeCheckout,readOnlyCheckout"
+ class="org.eclipse.emf.cdo.internal.explorer.checkouts.CDOCheckoutObjectProperties$ElementTester"/>
</extension>
<extension point="org.eclipse.emf.cdo.viewProviders">
diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutObjectProperties.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutObjectProperties.java
index 3b0a81b3aa..42ef112512 100644
--- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutObjectProperties.java
+++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutObjectProperties.java
@@ -11,6 +11,9 @@
package org.eclipse.emf.cdo.internal.explorer.checkouts;
import org.eclipse.emf.cdo.explorer.CDOExplorerUtil;
+import org.eclipse.emf.cdo.explorer.checkouts.CDOCheckout;
+
+import org.eclipse.emf.internal.cdo.object.CDOElementTester;
import org.eclipse.net4j.util.properties.DefaultPropertyTester;
import org.eclipse.net4j.util.properties.IProperties;
@@ -26,6 +29,8 @@ public class CDOCheckoutObjectProperties extends Properties<EObject>
{
public static final IProperties<EObject> INSTANCE = new CDOCheckoutObjectProperties();
+ public static final String NAMESPACE = "org.eclipse.emf.cdo.explorer.object";
+
private CDOCheckoutObjectProperties()
{
super(EObject.class);
@@ -38,6 +43,66 @@ public class CDOCheckoutObjectProperties extends Properties<EObject>
return CDOExplorerUtil.getCheckout(object) != null;
}
});
+
+ add(new Property<EObject>("stateCheckout")
+ {
+ @Override
+ protected Object eval(EObject object)
+ {
+ CDOCheckout checkout = CDOExplorerUtil.getCheckout(object);
+ if (checkout == null)
+ {
+ return null;
+ }
+
+ return checkout.getState();
+ }
+ });
+
+ add(new Property<EObject>("openCheckout")
+ {
+ @Override
+ protected Object eval(EObject object)
+ {
+ CDOCheckout checkout = CDOExplorerUtil.getCheckout(object);
+ if (checkout == null)
+ {
+ return null;
+ }
+
+ return checkout.isOpen();
+ }
+ });
+
+ add(new Property<EObject>("typeCheckout")
+ {
+ @Override
+ protected Object eval(EObject object)
+ {
+ CDOCheckout checkout = CDOExplorerUtil.getCheckout(object);
+ if (checkout == null)
+ {
+ return null;
+ }
+
+ return checkout.getType();
+ }
+ });
+
+ add(new Property<EObject>("readOnlyCheckout")
+ {
+ @Override
+ protected Object eval(EObject object)
+ {
+ CDOCheckout checkout = CDOExplorerUtil.getCheckout(object);
+ if (checkout == null)
+ {
+ return null;
+ }
+
+ return checkout.isReadOnly();
+ }
+ });
}
public static void main(String[] args)
@@ -50,11 +115,20 @@ public class CDOCheckoutObjectProperties extends Properties<EObject>
*/
public static final class Tester extends DefaultPropertyTester<EObject>
{
- public static final String NAMESPACE = "org.eclipse.emf.cdo.explorer.object";
-
public Tester()
{
super(NAMESPACE, INSTANCE);
}
}
+
+ /**
+ * @author Eike Stepper
+ */
+ public static final class ElementTester extends CDOElementTester
+ {
+ public ElementTester()
+ {
+ super(NAMESPACE, INSTANCE);
+ }
+ }
}

Back to the top