Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Goubet2013-06-24 05:25:23 -0400
committerLaurent Goubet2013-06-24 05:39:47 -0400
commit68a39767bef4abb768055e6fc0b33618438fb620 (patch)
tree28908222815ff47e56432ebe0f1b83bfcd797d03
parent1f415093b247995fd0d474227dd6420f3ac0ff9a (diff)
downloadorg.eclipse.emf.compare-68a39767bef4abb768055e6fc0b33618438fb620.tar.gz
org.eclipse.emf.compare-68a39767bef4abb768055e6fc0b33618438fb620.tar.xz
org.eclipse.emf.compare-68a39767bef4abb768055e6fc0b33618438fb620.zip
Invalid path for local file revision, regression introduced in e8c43e5
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/StreamAccessorStorage.java24
1 files changed, 22 insertions, 2 deletions
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/StreamAccessorStorage.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/StreamAccessorStorage.java
index e3e548c95..db610319f 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/StreamAccessorStorage.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/logical/StreamAccessorStorage.java
@@ -94,6 +94,27 @@ public class StreamAccessorStorage implements IStorage {
if (storagePath != null) {
fullPath = storagePath;
} else {
+ fullPath = findPath(element);
+ }
+
+ return new StreamAccessorStorage((IStreamContentAccessor)element, fullPath);
+ }
+
+ /**
+ * This will tries and find a path for the given typed element. If that element can be adapted as an
+ * IResource, we'll use that resource's path. Otherwise, we'll try and adapt it to a File Revision and use
+ * that revision's path.
+ *
+ * @param element
+ * The element for which we need a path.
+ * @return A path for the given element.
+ */
+ private static String findPath(ITypedElement element) {
+ final String fullPath;
+ final IFile file = findFile(element);
+ if (file != null) {
+ fullPath = file.getFullPath().toString();
+ } else {
final IFileRevision revision = findFileRevision(element);
String tmp = null;
if (revision != null) {
@@ -116,8 +137,7 @@ public class StreamAccessorStorage implements IStorage {
fullPath = element.getName();
}
}
-
- return new StreamAccessorStorage((IStreamContentAccessor)element, fullPath);
+ return fullPath;
}
/**

Back to the top