X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.graph%2Fsrc%2Forg%2Fsimantics%2Fgraph%2Frefactoring%2FFixExportedOntology.java;h=91d85ecf9732f9c5395b1094c2731a0d468e7d4c;hp=1c567b1e21d39294f00652a0e8467e33cf803044;hb=fa806341cc06b72051d5e8d709674eb9d5c2bf00;hpb=3b4bf8acfe0a6126ce44c5452ffee4dd9af119e3;ds=sidebyside 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 1c567b1e2..91d85ecf9 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 @@ -40,17 +40,33 @@ public class FixExportedOntology { } } + + public static void createTg(Path input) throws Exception { + Path output = input.getParent().resolve("graph.tg"); + createTg(input, output); + } + + private static void createTg(Path input, Path output) throws Exception { + convertExportedSharedOntologyIntoBundleOntology(input, output); + } + + public static void createPGraph(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("\\.")) + newName = newName.split("\\.")[0]; + Path output2 = input.getParent().resolve(newName + ".pgraph"); + Files.write(output2, listing.getBytes(),StandardOpenOption.CREATE); + } public static void main(String[] args) throws Exception { if (args.length == 0) { System.out.println("Required arguments: []"); } else if (args.length == 1) { Path input = Paths.get(args[0]); - Path output1 = input.getParent().resolve("graph.tg"); - TransferableGraph1 tg = convertExportedSharedOntologyIntoBundleOntology(input, output1); - String listing = PrettyPrintTG.print(tg, false); - Path output2 = Paths.get(args[0].substring(0, args[0].length() - ".sharedLibrary".length()) + ".pgraph"); - Files.write(output2, listing.getBytes(),StandardOpenOption.CREATE); + createPGraph(input); } else { convertExportedSharedOntologyIntoBundleOntology(Paths.get(args[0]), Paths.get(args[1])); }