]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Minor fix and optimization for exporting TG and Pgraph with sharedlib 27/1127/2
authorjsimomaa <jani.simomaa@gmail.com>
Thu, 19 Oct 2017 05:50:48 +0000 (08:50 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Thu, 19 Oct 2017 06:02:33 +0000 (09:02 +0300)
refs #7547

Change-Id: I99cd747639430fa195dafdd1923a3257eb72be43

bundles/org.simantics.graph/src/org/simantics/graph/refactoring/FixExportedOntology.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/sharedontology/wizard/SharedOntologyExporter.java

index 91d85ecf9732f9c5395b1094c2731a0d468e7d4c..90738f70d1c8243366659ff2901ce315247eafc9 100644 (file)
@@ -50,12 +50,12 @@ public class FixExportedOntology {
            convertExportedSharedOntologyIntoBundleOntology(input, output);
        }
        
-       public static void createPGraph(Path input) throws Exception {
+       public static void createTGAndPGraph(Path input) throws Exception {
         Path output1 = input.getParent().resolve("graph.tg");
         TransferableGraph1 tg = convertExportedSharedOntologyIntoBundleOntology(input, output1);
         String listing = PrettyPrintTG.print(tg, false);
         String newName = input.getFileName().toString();
-        if (newName.contains("\\."))
+        if (newName.contains("."))
             newName = newName.split("\\.")[0];
         Path output2 = input.getParent().resolve(newName + ".pgraph");
         Files.write(output2, listing.getBytes(),StandardOpenOption.CREATE);
@@ -66,7 +66,7 @@ public class FixExportedOntology {
                        System.out.println("Required arguments: <input .sharedLibrary file> [<output .tg file>]");
                } else if (args.length == 1) {
                        Path input = Paths.get(args[0]);
-                       createPGraph(input);
+                       createTGAndPGraph(input);
                } else {
                        convertExportedSharedOntologyIntoBundleOntology(Paths.get(args[0]), Paths.get(args[1]));
                }
index 226aa840f88af9cf6c91da5f6b5350cafdea64ed..410d1797661f7d3e62412cf717268bad5043b370 100644 (file)
@@ -82,8 +82,7 @@ public class SharedOntologyExporter implements IRunnableWithProgress {
        if (pgraphAndTg) {
             try {
                 Path input = Paths.get(location.toURI());
-                FixExportedOntology.createTg(input);
-                FixExportedOntology.createPGraph(input);
+                FixExportedOntology.createTGAndPGraph(input);
             } catch (Exception e) {
                 LOGGER.error("Could not generate TG and Pgraph", e);
             }