2424import com .github .gumtreediff .actions .model .Action ;
2525import com .github .gumtreediff .gen .Generators ;
2626import com .github .gumtreediff .io .ActionsIoUtils ;
27+ import com .github .gumtreediff .matchers .MappingStore ;
2728import com .github .gumtreediff .matchers .Matcher ;
2829import com .github .gumtreediff .matchers .Matchers ;
2930import com .github .gumtreediff .tree .TreeContext ;
4041
4142public class ScriptView implements Renderable {
4243
44+ private final MappingStore mappings ;
45+
46+ private final TreeContext src ;
47+
48+ private final TreeContext dst ;
49+
4350 private File fSrc ;
4451
4552 private File fDst ;
@@ -49,11 +56,12 @@ public class ScriptView implements Renderable {
4956 public ScriptView (File fSrc , File fDst ) throws IOException {
5057 this .fSrc = fSrc ;
5158 this .fDst = fDst ;
52- TreeContext src = Generators .getInstance ().getTree (fSrc .getAbsolutePath ());
53- TreeContext dst = Generators .getInstance ().getTree (fDst .getAbsolutePath ());
59+ src = Generators .getInstance ().getTree (fSrc .getAbsolutePath ());
60+ dst = Generators .getInstance ().getTree (fDst .getAbsolutePath ());
5461 Matcher matcher = Matchers .getInstance ().getMatcher (src .getRoot (), dst .getRoot ());
5562 matcher .match ();
56- ActionGenerator g = new ActionGenerator (src .getRoot (), dst .getRoot (), matcher .getMappings ());
63+ mappings = matcher .getMappings ();
64+ ActionGenerator g = new ActionGenerator (src .getRoot (), dst .getRoot (), mappings );
5765 g .generate ();
5866 this .script = g .getActions ();
5967 }
@@ -72,7 +80,7 @@ public void renderOn(HtmlCanvas html) throws IOException {
7280 .write ("Script " )
7381 .small ().content (String .format ("%s -> %s" , fSrc .getName (), fDst .getName ()))
7482 ._h3 ()
75- .pre ().content (ActionsIoUtils .toText (this .script ))
83+ .pre ().content (ActionsIoUtils .toText (src , this .script , mappings ). toString ( ))
7684 ._div ()
7785 ._div ()
7886 ._div ()
0 commit comments