Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Goubet2015-06-22 12:08:20 +0000
committerLaurent Goubet2015-06-22 13:21:12 +0000
commit9e880491e7ddd39b5cf6208c7e0099020dfe4f7c (patch)
treeb34a1fa9d3c0af5674856e914511568ac0f483bc /plugins
parentb73d57a161206bbc5474571f0daaebfa2fe07a7f (diff)
downloadorg.eclipse.emf.compare-9e880491e7ddd39b5cf6208c7e0099020dfe4f7c.tar.gz
org.eclipse.emf.compare-9e880491e7ddd39b5cf6208c7e0099020dfe4f7c.tar.xz
org.eclipse.emf.compare-9e880491e7ddd39b5cf6208c7e0099020dfe4f7c.zip
Caching - Don't minimize the logical model eagerly
We use a cache to make sure the EMFModelProvider can always return the logical model of files as fast as possible while reducing I/O operations to the bare minimum. Minimizing the logical model _before_ we cache it means we'll only be able to use that cache for the minimized set of resources, forcing us to recompute the whole model for all *other* resources. Change-Id: I65612d9a53b454a288926a3533d57910b13a7e32
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/EMFModelProvider.java13
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/NullModelMinimizer.java27
2 files changed, 36 insertions, 4 deletions
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/EMFModelProvider.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/EMFModelProvider.java
index ba7da3a4c..9fed1d857 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/EMFModelProvider.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/EMFModelProvider.java
@@ -44,7 +44,6 @@ import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
-import org.eclipse.emf.compare.ide.ui.logical.IModelMinimizer;
import org.eclipse.emf.compare.ide.ui.logical.IModelResolver;
import org.eclipse.emf.compare.ide.ui.logical.IStorageProvider;
import org.eclipse.emf.compare.ide.ui.logical.IStorageProviderAccessor;
@@ -254,6 +253,10 @@ public class EMFModelProvider extends ModelProvider {
resourceMappingCache.put(res, syncModel);
}
}
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("EMFModelProvider - Minimizing model"); //$NON-NLS-1$
+ }
+ new IdenticalResourceMinimizer().minimize(syncModel, monitor);
} else if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Cache FOUND entry for " + file); //$NON-NLS-1$
}
@@ -272,6 +275,9 @@ public class EMFModelProvider extends ModelProvider {
* <code>file1</code> if called with a {@link ResourceMappingContext#LOCAL_CONTEXT local context}, but it
* will contain both files if called with a {@link RemoteResourceMappingContext remote context}.
* </p>
+ * <p>
+ * <b>Note</b> that this will return an unminimized synchronization model.
+ * </p>
*
* @param file
* The file which logical model is to be resolved.
@@ -326,9 +332,8 @@ public class EMFModelProvider extends ModelProvider {
final IModelResolver remoteResolver = EMFCompareIDEUIPlugin.getDefault()
.getModelResolverRegistry().getBestResolverFor(leftStorage);
- final IModelMinimizer minimizer = new IdenticalResourceMinimizer();
- final ComparisonScopeBuilder builder = new ComparisonScopeBuilder(remoteResolver, minimizer,
- accessor);
+ final ComparisonScopeBuilder builder = new ComparisonScopeBuilder(remoteResolver,
+ new NullModelMinimizer(), accessor);
syncModel = builder.buildSynchronizationModel(left, right, origin, actualMonitor);
} else {
// TODO wouldn't it be better to use Collections.singleton(file) for the right and origin?
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/NullModelMinimizer.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/NullModelMinimizer.java
new file mode 100644
index 000000000..0f09eb034
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/NullModelMinimizer.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.ide.ui.internal.logical;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.compare.ide.ui.logical.IModelMinimizer;
+import org.eclipse.emf.compare.ide.ui.logical.SynchronizationModel;
+
+/**
+ * An empty implementation of an {@link IModelMinimizer}.
+ *
+ * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
+ */
+public class NullModelMinimizer implements IModelMinimizer {
+ /** {@inheritDoc} */
+ public void minimize(SynchronizationModel syncModel, IProgressMonitor monitor) {
+ // Do nothing
+ }
+}

Back to the top