X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.graph%2Fsrc%2Forg%2Fsimantics%2Fgraph%2Frefactoring%2FPrintReferencesTool.java;h=d980692276b13d2d67b0c8949e5be30c31c843fa;hb=63f6a68f31de96e8e8f31cd99b79c365029aa557;hp=e98affe7b99ac028c37c75b6f116f32a5e558668;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.graph/src/org/simantics/graph/refactoring/PrintReferencesTool.java b/bundles/org.simantics.graph/src/org/simantics/graph/refactoring/PrintReferencesTool.java index e98affe7b..d98069227 100644 --- a/bundles/org.simantics.graph/src/org/simantics/graph/refactoring/PrintReferencesTool.java +++ b/bundles/org.simantics.graph/src/org/simantics/graph/refactoring/PrintReferencesTool.java @@ -1,47 +1,47 @@ -package org.simantics.graph.refactoring; - -import gnu.trove.map.hash.THashMap; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; - -import org.simantics.databoard.Files; -import org.simantics.graph.query.TransferableGraphConversion; -import org.simantics.graph.representation.old.OldTransferableGraph1; -import org.simantics.graph.store.IdentityStore; -import org.simantics.graph.store.IdentityStore.ConsistsOf; - -public class PrintReferencesTool { - - public static void main(String[] args) throws Exception { - print(new File(args[0])); - } - - public static void print(File input) throws IOException { - OldTransferableGraph1 tg = (OldTransferableGraph1) - Files.readFile(input, OldTransferableGraph1.BINDING); - GraphRefactoringUtils.fixIncorrectRoot(tg.identities); - IdentityStore idStore = TransferableGraphConversion.extractIdentities(tg); - printExternals(idStore, idStore.getRoot(""), 0); - } - - private static void printExternals(IdentityStore idStore, int cur, int indentation) { - THashMap map = idStore.getChildMap(cur); - if(map == null) - return; - ArrayList names = new ArrayList(map.keySet()); - Collections.sort(names); - for(String name : names) { - ConsistsOf co = map.get(name); - if(!idStore.isNewResource(co.child)) { - for(int i=0;i map = idStore.getChildMap(cur); + if(map == null) + return; + ArrayList names = new ArrayList(map.keySet()); + Collections.sort(names); + for(String name : names) { + ConsistsOf co = map.get(name); + if(!idStore.isNewResource(co.child)) { + for(int i=0;i