Search in sources :

Example 1 with WranglerRefactoringBackend

use of org.erlide.wrangler.refactoring.backend.internal.WranglerRefactoringBackend in project erlide_eclipse by erlang.

the class DuplicateDetectionAction method callRefactoring.

@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());
}
Also used : WranglerRefactoringBackend(org.erlide.wrangler.refactoring.backend.internal.WranglerRefactoringBackend) OtpErlangList(com.ericsson.otp.erlang.OtpErlangList) IErlMemberSelection(org.erlide.wrangler.refactoring.selection.IErlMemberSelection) RpcResult(org.erlide.runtime.rpc.RpcResult) OtpErlangString(com.ericsson.otp.erlang.OtpErlangString) OtpErlangString(com.ericsson.otp.erlang.OtpErlangString) WranglerRpcParsingException(org.erlide.wrangler.refactoring.exception.WranglerRpcParsingException)

Example 2 with WranglerRefactoringBackend

use of org.erlide.wrangler.refactoring.backend.internal.WranglerRefactoringBackend in project erlide_eclipse by erlang.

the class SimilarDetectionAction method callRefactoring.

@Override
protected IResultParser callRefactoring() throws WranglerRpcParsingException, CoreException, IOException, WranglerWarningException {
    final WranglerRefactoringBackend backend = WranglerBackendManager.getRefactoringBackend();
    final IErlMemberSelection sel = (IErlMemberSelection) GlobalParameters.getWranglerSelection();
    RpcResult result;
    final String functionName = "sim_code_detection_eclipse";
    if (onlyInFile) {
        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, "xiiiidxi", fpl, minLen, minToks, minFreq, maxNewVars, simScore, sel.getSearchPath(), GlobalParameters.getTabWidth());
    } else {
        result = backend.callWithoutParser(WranglerRefactoringBackend.UNLIMITED_TIMEOUT, functionName, "xiiiidxi", sel.getSearchPath(), minLen, minToks, minFreq, maxNewVars, simScore, sel.getSearchPath(), GlobalParameters.getTabWidth());
    }
    if (!result.isOk()) {
        throw new WranglerRpcParsingException("Rpc error");
    }
    return new DuplicateDetectionParser(result.getValue());
}
Also used : WranglerRefactoringBackend(org.erlide.wrangler.refactoring.backend.internal.WranglerRefactoringBackend) OtpErlangList(com.ericsson.otp.erlang.OtpErlangList) IErlMemberSelection(org.erlide.wrangler.refactoring.selection.IErlMemberSelection) RpcResult(org.erlide.runtime.rpc.RpcResult) OtpErlangString(com.ericsson.otp.erlang.OtpErlangString) OtpErlangString(com.ericsson.otp.erlang.OtpErlangString) WranglerRpcParsingException(org.erlide.wrangler.refactoring.exception.WranglerRpcParsingException)

Example 3 with WranglerRefactoringBackend

use of org.erlide.wrangler.refactoring.backend.internal.WranglerRefactoringBackend in project erlide_eclipse by erlang.

the class SimilarSearchAction method callRefactoring.

@Override
protected IResultParser callRefactoring() throws WranglerRpcParsingException, CoreException, IOException, WranglerWarningException {
    final IErlMemberSelection sel = (IErlMemberSelection) GlobalParameters.getWranglerSelection();
    final WranglerRefactoringBackend backend = WranglerBackendManager.getRefactoringBackend();
    RpcResult result = null;
    String functionName;
    if (onlyInFile) {
        functionName = "simi_expr_search_in_buffer_eclipse";
    } else {
        functionName = "simi_expr_search_in_dirs_eclipse";
    }
    result = backend.callWithoutParser(WranglerRefactoringBackend.UNLIMITED_TIMEOUT, functionName, "sxxxxi", sel.getFilePath(), sel.getSelectionRange().getStartPos(), sel.getSelectionRange().getEndPos(), new OtpErlangFloat(simScore), sel.getSearchPath(), GlobalParameters.getTabWidth());
    if (result.isOk()) {
        return new SimilarExpressionSearchParser(result.getValue());
    }
    throw new WranglerRpcParsingException("RPC error");
}
Also used : WranglerRefactoringBackend(org.erlide.wrangler.refactoring.backend.internal.WranglerRefactoringBackend) IErlMemberSelection(org.erlide.wrangler.refactoring.selection.IErlMemberSelection) RpcResult(org.erlide.runtime.rpc.RpcResult) OtpErlangFloat(com.ericsson.otp.erlang.OtpErlangFloat) WranglerRpcParsingException(org.erlide.wrangler.refactoring.exception.WranglerRpcParsingException)

Example 4 with WranglerRefactoringBackend

use of org.erlide.wrangler.refactoring.backend.internal.WranglerRefactoringBackend in project erlide_eclipse by erlang.

the class ExpressionSearchAction method callRefactoring.

@Override
protected IResultParser callRefactoring() throws WranglerRpcParsingException {
    final IErlMemberSelection sel = (IErlMemberSelection) GlobalParameters.getWranglerSelection();
    final WranglerRefactoringBackend backend = WranglerBackendManager.getRefactoringBackend();
    final RpcResult result = backend.callWithoutParser(WranglerRefactoringBackend.UNLIMITED_TIMEOUT, "expr_search_eclipse", "sxxi", sel.getFilePath(), sel.getSelectionRange().getStartPos(), sel.getSelectionRange().getEndPos(), GlobalParameters.getTabWidth());
    if (result.isOk()) {
        return new ExpressionSearchParser(result.getValue());
    }
    throw new WranglerRpcParsingException("RPC error");
}
Also used : WranglerRefactoringBackend(org.erlide.wrangler.refactoring.backend.internal.WranglerRefactoringBackend) IErlMemberSelection(org.erlide.wrangler.refactoring.selection.IErlMemberSelection) RpcResult(org.erlide.runtime.rpc.RpcResult) WranglerRpcParsingException(org.erlide.wrangler.refactoring.exception.WranglerRpcParsingException)

Aggregations

RpcResult (org.erlide.runtime.rpc.RpcResult)4 WranglerRefactoringBackend (org.erlide.wrangler.refactoring.backend.internal.WranglerRefactoringBackend)4 WranglerRpcParsingException (org.erlide.wrangler.refactoring.exception.WranglerRpcParsingException)4 IErlMemberSelection (org.erlide.wrangler.refactoring.selection.IErlMemberSelection)4 OtpErlangList (com.ericsson.otp.erlang.OtpErlangList)2 OtpErlangString (com.ericsson.otp.erlang.OtpErlangString)2 OtpErlangFloat (com.ericsson.otp.erlang.OtpErlangFloat)1