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