From: jsimomaa Date: Thu, 19 Oct 2017 05:50:48 +0000 (+0300) Subject: Minor fix and optimization for exporting TG and Pgraph with sharedlib X-Git-Tag: v1.31.0~106^2 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=e0deb46135b4d11a6c8adf1d11189ca856a2ebb0;p=simantics%2Fplatform.git Minor fix and optimization for exporting TG and Pgraph with sharedlib refs #7547 Change-Id: I99cd747639430fa195dafdd1923a3257eb72be43 --- diff --git a/bundles/org.simantics.graph/src/org/simantics/graph/refactoring/FixExportedOntology.java b/bundles/org.simantics.graph/src/org/simantics/graph/refactoring/FixExportedOntology.java index 91d85ecf9..90738f70d 100644 --- a/bundles/org.simantics.graph/src/org/simantics/graph/refactoring/FixExportedOntology.java +++ b/bundles/org.simantics.graph/src/org/simantics/graph/refactoring/FixExportedOntology.java @@ -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: []"); } 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])); } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/sharedontology/wizard/SharedOntologyExporter.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/sharedontology/wizard/SharedOntologyExporter.java index 226aa840f..410d17976 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/sharedontology/wizard/SharedOntologyExporter.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/sharedontology/wizard/SharedOntologyExporter.java @@ -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); }