@SuppressWarnings("boxing")
@Override
protected IResultParser callRefactoring() throws WranglerRpcParsingException,
CoreException, IOException, WranglerWarningException {
String functionName;
RpcResult result;
// getting the path of the fragment
final String suffixPath = getSuffixPath();
ErlLogger.debug("Suffix binary at: " + suffixPath);
final WranglerRefactoringBackend backend = WranglerBackendManager
.getRefactoringBackend();
final IErlMemberSelection sel = (IErlMemberSelection) GlobalParameters
.getWranglerSelection();
if (onlyInfile) {
functionName = "duplicated_code_eclipse";
final OtpErlangString fp = new OtpErlangString(sel.getFilePath());
final OtpErlangString[] fpa = new OtpErlangString[1];
fpa[0] = fp;
final OtpErlangList fpl = new OtpErlangList(fpa);
result = backend.callWithoutParser(
WranglerRefactoringBackend.UNLIMITED_TIMEOUT, functionName, "xiiis",
fpl, minToks, minClones, GlobalParameters.getTabWidth(), suffixPath);
} else {
functionName = "duplicated_code_eclipse";
result = backend.callWithoutParser(
WranglerRefactoringBackend.UNLIMITED_TIMEOUT, functionName, "xiiis",
sel.getSearchPath(), minToks, minClones,
GlobalParameters.getTabWidth(), suffixPath);
}
if (!result.isOk()) {
throw new WranglerRpcParsingException("Rpc error");
}
return new DuplicateDetectionParser(result.getValue());
}