Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Richard2014-01-23 09:01:58 -0500
committerAxel Richard2014-01-28 03:39:57 -0500
commite980a55327fd951e8f534b4bd468c511292b4354 (patch)
tree1abcad33f3c1c91a06186e83ddabe9ec165c0c38 /plugins/org.eclipse.emf.compare.ide.ui/src
parentc837889966369140ccc8c28a427833659a21f8bc (diff)
downloadorg.eclipse.emf.compare-e980a55327fd951e8f534b4bd468c511292b4354.tar.gz
org.eclipse.emf.compare-e980a55327fd951e8f534b4bd468c511292b4354.tar.xz
org.eclipse.emf.compare-e980a55327fd951e8f534b4bd468c511292b4354.zip
Improve performance of ProjectModelResolver
The method ResourceUtil.getContentTypes(IFile) was called several times for the same IFile. Reduces calls to 1 per IFile. Change-Id: I44f5fb54301016af2fa08d69bd7260941ea16502
Diffstat (limited to 'plugins/org.eclipse.emf.compare.ide.ui/src')
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/ProjectModelResolver.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/ProjectModelResolver.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/ProjectModelResolver.java
index f66d4f1ed..9cd45fa25 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/ProjectModelResolver.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/ProjectModelResolver.java
@@ -42,6 +42,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIMessages;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
@@ -50,6 +51,7 @@ import org.eclipse.emf.compare.ide.ui.logical.IStorageProvider;
import org.eclipse.emf.compare.ide.ui.logical.IStorageProviderAccessor;
import org.eclipse.emf.compare.ide.ui.logical.IStorageProviderAccessor.DiffSide;
import org.eclipse.emf.compare.ide.ui.logical.SynchronizationModel;
+import org.eclipse.emf.compare.ide.utils.ResourceUtil;
import org.eclipse.emf.compare.ide.utils.StorageTraversal;
import org.eclipse.emf.compare.ide.utils.StorageURIConverter;
@@ -349,8 +351,9 @@ public class ProjectModelResolver extends LogicalModelResolver {
*/
protected static final boolean hasModelType(IFile file) {
boolean isModel = false;
+ final IContentType[] contentTypes = ResourceUtil.getContentTypes(file);
for (int i = 0; i < MODEL_CONTENT_TYPES.length && !isModel; i++) {
- isModel = hasContentType(file, MODEL_CONTENT_TYPES[i]);
+ isModel = hasContentType(MODEL_CONTENT_TYPES[i], contentTypes);
}
return isModel;
}

Back to the top