Skip to content

Commit 6afa3e4

Browse files
committed
fixed scriptview for new api
1 parent e28d87a commit 6afa3e4

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

client.diff/src/main/java/com/github/gumtreediff/client/diff/ui/web/views/ScriptView.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import com.github.gumtreediff.actions.model.Action;
2525
import com.github.gumtreediff.gen.Generators;
2626
import com.github.gumtreediff.io.ActionsIoUtils;
27+
import com.github.gumtreediff.matchers.MappingStore;
2728
import com.github.gumtreediff.matchers.Matcher;
2829
import com.github.gumtreediff.matchers.Matchers;
2930
import com.github.gumtreediff.tree.TreeContext;
@@ -40,6 +41,12 @@
4041

4142
public 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()

core/src/main/java/com/github/gumtreediff/io/ActionsIoUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ protected ActionFormatter newFormatter(TreeContext ctx, Writer writer) throws Ex
5959
};
6060
}
6161

62-
abstract static class ActionSerializer extends AbstractSerializer {
62+
public abstract static class ActionSerializer extends AbstractSerializer {
6363
final TreeContext context;
6464
final MappingStore mappings;
6565
final List<Action> actions;

0 commit comments

Comments
 (0)