MCPcopy Create free account
hub / github.com/DeNA/PacketProxy / update

Method update

src/main/java/core/packetproxy/gui/GUIDiffJson.java:56–105  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

54 }
55
56 @Override
57 public void update() throws Exception {
58 DiffSet ds;
59 if (jc.isSelected()) {
60
61 ds = sortUniq(DiffJson.getInstance().getSet());
62 } else {
63
64 ds = DiffJson.getInstance().getSet();
65 }
66 byte[] origData = PacketProxyUtility.getInstance().prettyFormatJSONInRawData(ds.getOriginal());
67 byte[] targetData = PacketProxyUtility.getInstance().prettyFormatJSONInRawData(ds.getTarget());
68 textOrig.setData(origData, false);
69 textTarg.setData(targetData, false);
70
71 docOrig = textOrig.getStyledDocument();
72 docTarg = textTarg.getStyledDocument();
73
74 docOrig.setCharacterAttributes(0, docOrig.getLength(), defaultAttr, false);
75 docTarg.setCharacterAttributes(0, docTarg.getLength(), defaultAttr, false);
76
77 DiffEventAdapter eventFordocOrig = new DiffEventAdapter() {
78
79 public void foundDelDelta(int pos, int length) throws Exception {
80 docOrig.setCharacterAttributes(pos, length, delAttr, false);
81 }
82
83 public void foundChgDelta(int pos, int length) throws Exception {
84 docOrig.setCharacterAttributes(pos, length, chgAttr, false);
85 }
86 };
87
88 DiffEventAdapter eventForTarget = new DiffEventAdapter() {
89
90 public void foundInsDelta(int pos, int length) throws Exception {
91 docTarg.setCharacterAttributes(pos, length, insAttr, false);
92 }
93
94 public void foundChgDelta(int pos, int length) throws Exception {
95 docTarg.setCharacterAttributes(pos, length, chgAttr, false);
96 }
97 };
98 if (jcCh.isSelected()) { // Character based
99
100 DiffJson.diffPerCharacter(ds, eventFordocOrig, eventForTarget);
101 } else { // Line based
102
103 DiffJson.diffPerLine(ds, eventFordocOrig, eventForTarget);
104 }
105 }
106}

Callers 1

actionPerformedMethod · 0.95

Calls 11

sortUniqMethod · 0.95
getInstanceMethod · 0.95
getInstanceMethod · 0.95
getOriginalMethod · 0.95
getTargetMethod · 0.95
diffPerCharacterMethod · 0.95
diffPerLineMethod · 0.95
getSetMethod · 0.80
setDataMethod · 0.45
getLengthMethod · 0.45

Tested by

no test coverage detected