Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2015-05-01 09:42:02 +0000
committerEike Stepper2015-05-01 09:42:02 +0000
commit547d9d2c99bbee2502e1cb1a347c60630dfedc6a (patch)
treeb77d0fe7a82127bfaf29948dae1e7d53dbf3780e /plugins/org.eclipse.emf.cdo.explorer
parent5f031cd4ef8bb769fce547dd3135073091aa221d (diff)
downloadcdo-547d9d2c99bbee2502e1cb1a347c60630dfedc6a.tar.gz
cdo-547d9d2c99bbee2502e1cb1a347c60630dfedc6a.tar.xz
cdo-547d9d2c99bbee2502e1cb1a347c60630dfedc6a.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/CDOExplorerManager.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/AbstractManager.java42
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutImpl.java13
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/OfflineCDOCheckout.java2
4 files changed, 37 insertions, 24 deletions
diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/CDOExplorerManager.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/CDOExplorerManager.java
index 3afe9e4a08..e8ff2d563a 100644
--- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/CDOExplorerManager.java
+++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/CDOExplorerManager.java
@@ -15,8 +15,6 @@ import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.core.runtime.IAdaptable;
-import java.util.Collection;
-
/**
* @author Eike Stepper
* @since 4.4
@@ -34,7 +32,7 @@ public interface CDOExplorerManager<T extends CDOExplorerElement> extends IConta
public ElementsChangedEvent.StructuralImpact getStructuralImpact();
- public Collection<Object> getChangedElements();
+ public Object[] getChangedElements();
/**
* @author Eike Stepper
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 ec2b8bcf9e..9d4f9188b6 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
@@ -10,10 +10,12 @@
*/
package org.eclipse.emf.cdo.internal.explorer;
+import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.explorer.CDOExplorerElement;
import org.eclipse.emf.cdo.explorer.CDOExplorerManager;
import org.eclipse.emf.cdo.explorer.CDOExplorerManager.ElementsChangedEvent.StructuralImpact;
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.container.SetContainer;
@@ -21,10 +23,10 @@ import org.eclipse.net4j.util.event.Event;
import org.eclipse.net4j.util.io.IOUtil;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
+import org.eclipse.emf.ecore.EObject;
+
import java.io.File;
import java.io.FileInputStream;
-import java.util.Collection;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
@@ -126,12 +128,33 @@ public abstract class AbstractManager<T extends CDOExplorerElement> extends SetC
public void fireElementChangedEvent(StructuralImpact structuralImpact, Object changedElement)
{
- fireEvent(new ElementsChangedImpl(this, structuralImpact, Collections.singleton(changedElement)));
+ if (changedElement instanceof CDOObject)
+ {
+ CDOObject cdoObject = (CDOObject)changedElement;
+ changedElement = CDOUtil.getEObject(cdoObject);
+ }
+
+ Object[] objects = { changedElement };
+ fireEvent(new ElementsChangedImpl(this, structuralImpact, objects));
}
- public void fireElementsChangedEvent(Collection<Object> changedElements)
+ public void fireElementsChangedEvent(Object[] objects)
{
- fireEvent(new ElementsChangedImpl(this, StructuralImpact.NONE, changedElements));
+ for (int i = 0; i < objects.length; i++)
+ {
+ Object object = objects[i];
+ if (object instanceof CDOObject)
+ {
+ CDOObject cdoObject = (CDOObject)object;
+ EObject instance = CDOUtil.getEObject(cdoObject);
+ if (instance != cdoObject)
+ {
+ objects[i] = instance;
+ }
+ }
+ }
+
+ fireEvent(new ElementsChangedImpl(this, StructuralImpact.NONE, objects));
}
public static Properties loadProperties(File folder, String fileName)
@@ -172,13 +195,12 @@ public abstract class AbstractManager<T extends CDOExplorerElement> extends SetC
private final StructuralImpact structuralImpact;
- private final Collection<Object> changedElements;
+ private final Object[] changedElements;
- public ElementsChangedImpl(CDOExplorerManager<?> manager, StructuralImpact structuralImpact,
- Collection<Object> changedElements)
+ public ElementsChangedImpl(CDOExplorerManager<?> manager, StructuralImpact structuralImpact, Object[] objects)
{
super(manager);
- this.changedElements = changedElements;
+ this.changedElements = objects;
this.structuralImpact = structuralImpact;
}
@@ -193,7 +215,7 @@ public abstract class AbstractManager<T extends CDOExplorerElement> extends SetC
return structuralImpact;
}
- public final Collection<Object> getChangedElements()
+ public final Object[] getChangedElements()
{
return changedElements;
}
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 0b90aa4e53..b298a4b05a 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
@@ -10,7 +10,6 @@
*/
package org.eclipse.emf.cdo.internal.explorer.checkouts;
-import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.common.branch.CDOBranch;
import org.eclipse.emf.cdo.common.branch.CDOBranchManager;
import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
@@ -614,19 +613,13 @@ public abstract class CDOCheckoutImpl extends AbstractElement implements CDOChec
if (event instanceof CDOViewLocksChangedEvent)
{
CDOViewLocksChangedEvent e = (CDOViewLocksChangedEvent)event;
- List<CDOObject> objects = e.getAffectedObjects(view);
- if (!objects.isEmpty())
+ EObject[] objects = e.getAffectedObjects(view);
+ if (objects.length != 0)
{
- List<Object> elements = new ArrayList<Object>();
- for (CDOObject object : objects)
- {
- elements.add(object);
- }
-
CDOCheckoutManagerImpl manager = getManager();
if (manager != null)
{
- manager.fireElementsChangedEvent(elements);
+ manager.fireElementsChangedEvent(objects);
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/OfflineCDOCheckout.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/OfflineCDOCheckout.java
index c978daee29..78da6e41c6 100644
--- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/OfflineCDOCheckout.java
+++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/OfflineCDOCheckout.java
@@ -86,7 +86,7 @@ public class OfflineCDOCheckout extends CDOCheckoutImpl
}
}
- getManager().fireElementsChangedEvent(objects);
+ getManager().fireElementsChangedEvent(objects.toArray());
}
}
};

Back to the top