]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.graph/src/org/simantics/graph/refactoring/GraphRefactoringUtils.java
Escape/unescape names of the externals when converting to/from URIs
[simantics/platform.git] / bundles / org.simantics.graph / src / org / simantics / graph / refactoring / GraphRefactoringUtils.java
index 90b134e33762b5f991baa5288a2974906f2bad7b..2f00156c3b36dfdd93db0010f38ec3d54af2b0d3 100644 (file)
@@ -96,7 +96,7 @@ public class GraphRefactoringUtils {
        String[] parts = URIStringUtils.splitURI(path);
        Identity parentId = recursePath(tg, parts[0]);
        tg.identities = Arrays.copyOf(tg.identities, tg.identities.length+1);
-       Identity childIdentity = new Identity(tg.resourceCount++, new External(parentId.resource, parts[1]));
+       Identity childIdentity = new Identity(tg.resourceCount++, new External(parentId.resource, URIStringUtils.unescape(parts[1])));
                tg.identities[tg.identities.length-1] = childIdentity;
                return childIdentity;
        
@@ -113,10 +113,10 @@ public class GraphRefactoringUtils {
                        
                        String[] parts = URIStringUtils.splitURI(ext.name);
                        Identity path = recursePath(tg, parts[0]);
-                       id.definition = new Internal(path.resource, parts[1]);
+                       id.definition = new Internal(path.resource, URIStringUtils.unescape(parts[1]));
                        
                        GraphStore store = TransferableGraphConversion.convert(tg);
-                       int rootId = store.identities.createPathToId(UriUtils.uriToPath(ext.name));
+                       int rootId = store.identities.createPathToId(UriUtils.uriToPathUnescaped(ext.name));
                        propagateNewMarks(store.identities, rootId);
 
                        TransferableGraph1 tgNew = TransferableGraphConversion.convert(store);
@@ -125,16 +125,16 @@ public class GraphRefactoringUtils {
                        tg.identities = tgNew.identities;
                        tg.values = tgNew.values;
                        tg.statements = tgNew.statements;
-                               
+
                        return;
                        
                 } else if (ext.type.startsWith("http://")) {
-                    String first = "http://Projects/Development Project";
+                    String first = "http://Projects/Development%20Project";
                     Identity path = recursePath(tg, first);
                     id.definition = new Internal(path.resource, ext.name);
                     
                     GraphStore store = TransferableGraphConversion.convert(tg);
-                    int rootId = store.identities.createPathToId(UriUtils.uriToPath(first + "/" + ext.name));
+                    int rootId = store.identities.createPathToId(UriUtils.uriToPathUnescaped(first + "/" + ext.name));
                     propagateNewMarks(store.identities, rootId);
 
                     TransferableGraph1 tgNew = TransferableGraphConversion.convert(store);
@@ -143,7 +143,7 @@ public class GraphRefactoringUtils {
                     tg.identities = tgNew.identities;
                     tg.values = tgNew.values;
                     tg.statements = tgNew.statements;
-
+                    
                 }
             }
         }