Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2015-05-13 16:17:19 +0000
committerEike Stepper2015-05-13 16:17:51 +0000
commitf9ad60bad8f4e3c07a8f0d4ac545d113f662e989 (patch)
tree3f3d8fe0d3c8e3076a2d2b631b7c6da5f57b091f /plugins/org.eclipse.emf.cdo.explorer
parentedec1df0eee39d0830583832ec052b931e961ff6 (diff)
downloadcdo-f9ad60bad8f4e3c07a8f0d4ac545d113f662e989.tar.gz
cdo-f9ad60bad8f4e3c07a8f0d4ac545d113f662e989.tar.xz
cdo-f9ad60bad8f4e3c07a8f0d4ac545d113f662e989.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')
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/CDOExplorerUtil.java24
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/checkouts/CDOCheckoutManager.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/AbstractManager.java17
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutManagerImpl.java5
4 files changed, 48 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/CDOExplorerUtil.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/CDOExplorerUtil.java
index 2768da2f61..a90781a47b 100644
--- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/CDOExplorerUtil.java
+++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/CDOExplorerUtil.java
@@ -11,6 +11,7 @@
package org.eclipse.emf.cdo.explorer;
import org.eclipse.emf.cdo.CDOElement;
+import org.eclipse.emf.cdo.eresource.CDOResourceNode;
import org.eclipse.emf.cdo.explorer.checkouts.CDOCheckout;
import org.eclipse.emf.cdo.explorer.checkouts.CDOCheckoutManager;
import org.eclipse.emf.cdo.explorer.repositories.CDORepositoryManager;
@@ -58,6 +59,12 @@ public final class CDOExplorerUtil
return CDOCheckoutViewProvider.getCheckout(uri);
}
+ if (object instanceof String)
+ {
+ String id = (String)object;
+ return getCheckoutManager().getCheckout(id);
+ }
+
return walkUp(object, null);
}
@@ -84,6 +91,23 @@ public final class CDOExplorerUtil
return null;
}
+ public static String getName(Object object)
+ {
+ if (object instanceof CDOCheckout)
+ {
+ CDOCheckout checkout = (CDOCheckout)object;
+ return checkout.getLabel();
+ }
+
+ if (object instanceof CDOResourceNode)
+ {
+ CDOResourceNode resourceNode = (CDOResourceNode)object;
+ return resourceNode.getName();
+ }
+
+ return null;
+ }
+
public static LinkedList<Object> getPath(Object object)
{
LinkedList<Object> path = new LinkedList<Object>();
diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/checkouts/CDOCheckoutManager.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/checkouts/CDOCheckoutManager.java
index d4e03bc458..0eeb87cdf3 100644
--- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/checkouts/CDOCheckoutManager.java
+++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/checkouts/CDOCheckoutManager.java
@@ -32,6 +32,8 @@ public interface CDOCheckoutManager extends CDOExplorerManager<CDOCheckout>
public CDOCheckout getCheckout(CDOView view);
+ public CDOCheckout getCheckoutByLabel(String label);
+
public CDOCheckout[] getCheckouts();
public CDOCheckout addCheckout(Properties properties);
diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/AbstractManager.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/AbstractManager.java
index 9d4f9188b6..b86b86082d 100644
--- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/AbstractManager.java
+++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/AbstractManager.java
@@ -18,6 +18,7 @@ import org.eclipse.emf.cdo.internal.explorer.bundle.OM;
import org.eclipse.emf.cdo.util.CDOUtil;
import org.eclipse.net4j.util.AdapterUtil;
+import org.eclipse.net4j.util.ObjectUtil;
import org.eclipse.net4j.util.container.SetContainer;
import org.eclipse.net4j.util.event.Event;
import org.eclipse.net4j.util.io.IOUtil;
@@ -79,6 +80,22 @@ public abstract class AbstractManager<T extends CDOExplorerElement> extends SetC
return elementMap.get(id);
}
+ public T getElementByLabel(String label)
+ {
+ synchronized (this)
+ {
+ for (T element : getSet())
+ {
+ if (ObjectUtil.equals(element.getLabel(), label))
+ {
+ return element;
+ }
+ }
+ }
+
+ return null;
+ }
+
public T newElement(Properties properties)
{
int i = 0;
diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutManagerImpl.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutManagerImpl.java
index 31a176a09b..5b7ab115d0 100644
--- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutManagerImpl.java
+++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutManagerImpl.java
@@ -54,6 +54,11 @@ public class CDOCheckoutManagerImpl extends AbstractManager<CDOCheckout>implemen
return viewMap.get(view);
}
+ public CDOCheckout getCheckoutByLabel(String label)
+ {
+ return getElementByLabel(label);
+ }
+
public CDOCheckout[] getCheckouts()
{
return getElements();

Back to the top