use of org.erlide.wrangler.refactoring.duplicatedcode.ui.elements.DuplicatedCodeElement in project erlide_eclipse by erlang.
the class SimilarExpressionSearchParser method parse.
/*
* Parse Wrangler messages which are in the following format: {ok, {[{{filename,
* startLine, startCol},{filePath, endLine, endCol}}], generalisation}
*
* @see org.erlide.wrangler.refactoring.duplicatedcode.core.IResultParser#parse
* (com.ericsson.otp.erlang.OtpErlangObject)
*/
@Override
public void parse(final OtpErlangObject object) {
try {
final OtpErlangTuple res = (OtpErlangTuple) object;
if (!"ok".equals(res.elementAt(0).toString())) {
setUnSuccessful(((OtpErlangString) res.elementAt(1)).stringValue());
return;
}
final OtpErlangTuple result = (OtpErlangTuple) res.elementAt(1);
if (result.elementAt(0).equals(new OtpErlangList())) {
setUnSuccessful("No more instances found!");
return;
}
final DuplicatedCodeElement dup = parseDuplicates(result);
duplicates = new ArrayList<>();
duplicates.add(dup);
isSuccessful = true;
errorMessage = null;
} catch (final Exception e) {
setUnSuccessful(e.getMessage());
}
}
Aggregations