Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2016-09-16 09:46:08 -0400
committerEike Stepper2016-09-16 09:46:08 -0400
commitf45b16448a5f3e3d64ff1d57d9b1e59f2a677a53 (patch)
tree7025db35aa15db6924682f0a971e07ebf19b4651
parentab5a2daa464d6fcfac41c7cf98ff43c6ab203ab7 (diff)
downloadcdo-committers/estepper/view-locking-optimization.tar.gz
cdo-committers/estepper/view-locking-optimization.tar.xz
cdo-committers/estepper/view-locking-optimization.zip
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTests.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_377212_Test.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOActionBarContributor.java72
3 files changed, 74 insertions, 2 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTests.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTests.java
index 9f77ee8861..196da2fa80 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTests.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTests.java
@@ -28,7 +28,7 @@ public class AllTests extends AllConfigs
{
addScenario(parent, MEM, JVM, NATIVE);
addScenario(parent, MEM_AUDITS, JVM, NATIVE);
- addScenario(parent, MEM_BRANCHES, JVM, NATIVE);
+ addScenario(parent, MEM_BRANCHES, JVM, NATIVE); // <-----
addScenario(parent, MEM_BRANCHES_UUIDS, JVM, NATIVE);
addScenario(parent, MEM, JVM, LEGACY);
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_377212_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_377212_Test.java
index 04f3fe512d..b2e132eb66 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_377212_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_377212_Test.java
@@ -24,7 +24,7 @@ import org.eclipse.emf.ecore.EObject;
*/
public class Bugzilla_377212_Test extends AbstractCDOTest
{
- public void testBalancedTree() throws Exception
+ public void _testBalancedTree() throws Exception
{
CDOSession session = openSession();
CDOTransaction transaction = session.openTransaction();
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOActionBarContributor.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOActionBarContributor.java
index 2e6e898465..7badc157f1 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOActionBarContributor.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOActionBarContributor.java
@@ -16,6 +16,9 @@ import org.eclipse.emf.cdo.internal.ui.actions.AutoReleaseLockExemptionAction;
import org.eclipse.emf.cdo.internal.ui.actions.ImportRootsAction;
import org.eclipse.emf.common.ui.viewer.IViewerProvider;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.domain.IEditingDomainProvider;
import org.eclipse.emf.edit.ui.action.ControlAction;
@@ -36,17 +39,21 @@ import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.action.SubContributionItem;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PartInitException;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.List;
/**
* @author Eike Stepper
@@ -138,6 +145,69 @@ public class CDOActionBarContributor extends EditingDomainActionBarContributor i
}
};
+ protected IAction benchmarkAction = new Action("Benchmark")
+ {
+ @Override
+ public void run()
+ {
+ if (activeEditorPart instanceof IViewerProvider)
+ {
+ Viewer viewer = ((IViewerProvider)activeEditorPart).getViewer();
+ if (viewer instanceof TreeViewer)
+ {
+ TreeViewer treeViewer = (TreeViewer)viewer;
+ IStructuredContentProvider contentProvider = (IStructuredContentProvider)treeViewer.getContentProvider();
+ Object[] elements = contentProvider.getElements(viewer.getInput());
+
+ long start = System.currentTimeMillis();
+
+ for (Object element : elements)
+ {
+ if (element instanceof EObject)
+ {
+ EObject eObject = (EObject)element;
+ iterate(eObject);
+ }
+ }
+
+ long millis = System.currentTimeMillis() - start;
+ System.out.println(millis);
+ MessageDialog.openInformation(activeEditor.getSite().getShell(), "Benchmark", "Millis: " + millis);
+ }
+ }
+ }
+
+ private void iterate(EObject eObject)
+ {
+ for (EStructuralFeature feature : eObject.eClass().getEAllStructuralFeatures())
+ {
+ Object value = eObject.eGet(feature, true);
+ boolean containment = feature instanceof EReference && ((EReference)feature).isContainment();
+
+ if (feature.isMany())
+ {
+ List<?> list = (List<?>)value;
+ for (Object element : list)
+ {
+ access(element, containment);
+ }
+ }
+ else
+ {
+ access(value, containment);
+ }
+ }
+ }
+
+ private void access(Object element, boolean containment)
+ {
+ if (containment)
+ {
+ iterate((EObject)element);
+ }
+ }
+ };
+
/**
* This will contain one {@link org.eclipse.emf.edit.ui.action.CreateChildAction} corresponding to each descriptor
* generated for the current selection by the item provider.
@@ -548,6 +618,8 @@ public class CDOActionBarContributor extends EditingDomainActionBarContributor i
refreshViewerAction.setId(REFRESH_VIEWER_ID);
menuManager.insertAfter("ui-actions", refreshViewerAction); //$NON-NLS-1$
+ menuManager.insertAfter("ui-actions", benchmarkAction); //$NON-NLS-1$
+
if (autoReleaseLockExemptionAction.init())
{
menuManager.insertAfter("additions", autoReleaseLockExemptionAction); //$NON-NLS-1$

Back to the top