Package org.racsor.jmeter.flex.messaging.swing.Diff

Examples of org.racsor.jmeter.flex.messaging.swing.Diff.Edit


        Iterator it = edits.iterator();
        int srcLast = 0;
        int dstLast = 0;
        try {
            while (it.hasNext()) {
                Edit edit = (Edit) it.next();
                if (edit.getSrcLocation() > srcLast) {
                    // catch up common items in between edits
                    String s = src.subSequence(srcLast, edit.getSrcLocation())
                    .toString();
                    combinedDoc.insertString(combinedDoc.getLength(), s,
                            unchanged);
                    srcDoc.insertString(srcDoc.getLength(), s, unchanged);
                }
                if (edit.getDstLocation() > dstLast) {
                    String d = dst.subSequence(dstLast, edit.getDstLocation())
                    .toString();
                    // catch up common items in between edits
                    dstDoc.insertString(dstDoc.getLength(), d, unchanged);
                }
                String s = edit.getSrc().toString();
                String d = edit.getDst().toString();
                if (edit.getSrc().length() > 0 && edit.getDst().length() > 0) {
                    combinedDoc.insertString(combinedDoc.getLength(), s,
                            deleted);
                    combinedDoc.insertString(combinedDoc.getLength(), d, added);
                    srcDoc.insertString(srcDoc.getLength(), s, changed);
                    dstDoc.insertString(dstDoc.getLength(), d, changed);
                    int v = countLines(s) - countLines(d);
                    if (v > 0) {
                        String cr = "";
                        for (int i = 0; i < v; i++)
                            cr = cr + "\n";
                        dstDoc.insertString(dstDoc.getLength(), cr, changed);
                    } else if (v < 0) {
                        v = -v;
                        String cr = "";
                        for (int i = 0; i < v; i++)
                            cr = cr + "\n";
                        srcDoc.insertString(srcDoc.getLength(), cr, changed);
                    }
                } else if (edit.getSrc().length() > 0) {
                    combinedDoc.insertString(combinedDoc.getLength(), s,
                            deleted);
                    srcDoc.insertString(srcDoc.getLength(), s, added);
                    dstDoc.insertString(dstDoc.getLength(), s.replaceAll(
                            "[^\n]", " "), deleted);
                } else if (edit.getDst().length() > 0) {
                    combinedDoc.insertString(combinedDoc.getLength(), d, added);
                    srcDoc.insertString(srcDoc.getLength(), d.replaceAll(
                            "[^\n]", " "), deleted);
                    dstDoc.insertString(dstDoc.getLength(), d, added);
                }
                srcLast = edit.getSrcLocation() + s.length();
                dstLast = edit.getDstLocation() + d.length();
            }
            if (srcLast < src.length()) {
                String s = src.subSequence(srcLast, src.length()).toString();
                combinedDoc.insertString(combinedDoc.getLength(), s, unchanged);
                srcDoc.insertString(srcDoc.getLength(), s, unchanged);
View Full Code Here

TOP

Related Classes of org.racsor.jmeter.flex.messaging.swing.Diff.Edit

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.