Search in sources :

Example 1 with OtpErlangInt

use of com.ericsson.otp.erlang.OtpErlangInt in project erlide_eclipse by erlang.

the class ErlideDoc method getOtpDoc.

@Override
public OtpErlangObject getOtpDoc(final IOtpRpc b, final ErlangFunctionCall functionCall) {
    OtpErlangObject res = null;
    final OtpErlangTuple input = new OtpErlangTuple(new OtpErlangObject[] { new OtpErlangAtom("external"), new OtpErlangAtom(functionCall.getModule()), new OtpErlangAtom(functionCall.getName()), new OtpErlangInt(functionCall.getArity()), new OtpErlangString("") });
    try {
        res = b.call(ErlideDoc.ERLIDE_OTP_DOC, "get_doc", "sxs", functionCall.getModule(), input, stateDir);
    } catch (final RpcException e) {
        ErlLogger.warn(e);
    }
    return res;
}
Also used : OtpErlangObject(com.ericsson.otp.erlang.OtpErlangObject) RpcException(org.erlide.runtime.rpc.RpcException) OtpErlangInt(com.ericsson.otp.erlang.OtpErlangInt) OtpErlangTuple(com.ericsson.otp.erlang.OtpErlangTuple) OtpErlangAtom(com.ericsson.otp.erlang.OtpErlangAtom) OtpErlangString(com.ericsson.otp.erlang.OtpErlangString)

Example 2 with OtpErlangInt

use of com.ericsson.otp.erlang.OtpErlangInt in project erlide_eclipse by erlang.

the class WranglerSyntaxBackend method varToPos.

protected SyntaxInfo varToPos(final OtpErlangTuple syntaxTree, final int line, final int col) {
    final OtpErlangInt[] position = new OtpErlangInt[2];
    position[0] = new OtpErlangInt(line);
    position[1] = new OtpErlangInt(col);
    final RpcResult res = backend.call_noexception(WranglerSyntaxBackend.INTERFACE_MODULE, WranglerSyntaxBackend.VAR_FUNCTION, "xx", syntaxTree, new OtpErlangTuple(position));
    return parseVarInfo(res.getValue());
}
Also used : OtpErlangInt(com.ericsson.otp.erlang.OtpErlangInt) RpcResult(org.erlide.runtime.rpc.RpcResult) OtpErlangTuple(com.ericsson.otp.erlang.OtpErlangTuple)

Example 3 with OtpErlangInt

use of com.ericsson.otp.erlang.OtpErlangInt in project erlide_eclipse by erlang.

the class CommandData method addTabWidth.

public void addTabWidth(final int tabWidth) {
    final List<OtpErlangObject> argsTmp = Arrays.asList(args);
    argsTmp.add(new OtpErlangInt(tabWidth));
    args = argsTmp.toArray(new OtpErlangObject[0]);
}
Also used : OtpErlangObject(com.ericsson.otp.erlang.OtpErlangObject) OtpErlangInt(com.ericsson.otp.erlang.OtpErlangInt)

Example 4 with OtpErlangInt

use of com.ericsson.otp.erlang.OtpErlangInt in project erlide_eclipse by erlang.

the class UserElementaryRefactoring method run.

@Override
public IRefactoringRpcMessage run(final IErlSelection selection) {
    final IErlMemberSelection sel = (IErlMemberSelection) selection;
    final OtpErlangList pos = new OtpErlangList(new OtpErlangInt[] { new OtpErlangInt(sel.getSelectionRange().getStartLine()), new OtpErlangInt(sel.getSelectionRange().getStartCol()) });
    final OtpErlangList selectionBeg = new OtpErlangList(new OtpErlangInt[] { new OtpErlangInt(sel.getSelectionRange().getStartLine()), new OtpErlangInt(sel.getSelectionRange().getStartCol()) });
    final OtpErlangList selectionEnd = new OtpErlangList(new OtpErlangInt[] { new OtpErlangInt(sel.getSelectionRange().getEndLine()), new OtpErlangInt(sel.getSelectionRange().getEndCol()) });
    final OtpErlangList selectionPos = new OtpErlangList(new OtpErlangObject[] { selectionBeg, selectionEnd });
    final OtpErlangList args = new OtpErlangList(new OtpErlangObject[] { new OtpErlangString(sel.getFilePath()), pos, selectionPos, prepareUserInput(), sel.getSearchPath(), new OtpErlangInt(GlobalParameters.getTabWidth()) });
    return WranglerBackendManager.getRefactoringBackend().call("run_refac_eclipse", "sx", getCallbackModule(), args);
}
Also used : OtpErlangList(com.ericsson.otp.erlang.OtpErlangList) IErlMemberSelection(org.erlide.wrangler.refactoring.selection.IErlMemberSelection) OtpErlangInt(com.ericsson.otp.erlang.OtpErlangInt) OtpErlangString(com.ericsson.otp.erlang.OtpErlangString)

Example 5 with OtpErlangInt

use of com.ericsson.otp.erlang.OtpErlangInt in project erlide_eclipse by erlang.

the class TraceDataHandler method createFunctionNode.

private ITreeNode createFunctionNode(final String label, final OtpErlangObject erlangObject) {
    final ITreeNode node = new TreeNode();
    if (erlangObject instanceof OtpErlangTuple) {
        final OtpErlangTuple functionTuple = (OtpErlangTuple) erlangObject;
        final OtpErlangAtom moduleName = (OtpErlangAtom) functionTuple.elementAt(TraceDataHandler.INDEX_FUNCTION_MODULE);
        final OtpErlangAtom functionName = (OtpErlangAtom) functionTuple.elementAt(TraceDataHandler.INDEX_FUNCTION_NAME);
        // args or arity node
        final TreeNode argsNode = new TreeNode();
        argsNode.setImage(Activator.getImage(Images.INFO_NODE));
        final OtpErlangObject arityOrArgs = functionTuple.elementAt(TraceDataHandler.INDEX_FUNCTION_ARGS);
        int arityValue = -1;
        if (arityOrArgs instanceof OtpErlangList) {
            // last element is a list of arguments
            final OtpErlangList arguments = (OtpErlangList) arityOrArgs;
            final StringBuilder builder = new StringBuilder("arguments: ");
            for (int i = 1; i < arguments.arity(); i++) {
                builder.append(arguments.elementAt(i)).append(", ");
            }
            arityValue = arguments.arity() - 1;
            argsNode.setLabel(builder.substring(0, builder.length() - 2));
        } else {
            // last element is arity
            try {
                if (functionTuple.elementAt(TraceDataHandler.INDEX_FUNCTION_ARGS) instanceof OtpErlangInt) {
                    arityValue = ((OtpErlangInt) functionTuple.elementAt(TraceDataHandler.INDEX_FUNCTION_ARGS)).intValue();
                } else {
                    arityValue = (int) ((OtpErlangLong) functionTuple.elementAt(TraceDataHandler.INDEX_FUNCTION_ARGS)).longValue();
                }
                argsNode.setLabel("arity: " + arityValue);
            } catch (final OtpErlangRangeException e) {
                ErlLogger.error(e);
            }
        }
        // module name node
        final TreeNode moduleNameNode = new ModuleNode(moduleName.atomValue());
        moduleNameNode.setLabel("module: " + moduleName);
        // function name node
        final TreeNode functionNameNode = new FunctionNode(moduleName.atomValue(), functionName.atomValue(), arityValue);
        functionNameNode.setLabel("function: " + functionName);
        node.addChildren(moduleNameNode, functionNameNode, argsNode);
        lastFunctionDescription = label + moduleName + ":" + functionName + "/" + arityValue;
    } else {
        lastFunctionDescription = "unknown";
    }
    node.setLabel(lastFunctionDescription);
    return node;
}
Also used : OtpErlangLong(com.ericsson.otp.erlang.OtpErlangLong) OtpErlangList(com.ericsson.otp.erlang.OtpErlangList) FunctionNode(org.erlide.tracing.core.mvc.model.treenodes.FunctionNode) OtpErlangRangeException(com.ericsson.otp.erlang.OtpErlangRangeException) OtpErlangAtom(com.ericsson.otp.erlang.OtpErlangAtom) ITreeNode(org.erlide.tracing.core.mvc.model.treenodes.ITreeNode) TreeNode(org.erlide.tracing.core.mvc.model.treenodes.TreeNode) ITreeNode(org.erlide.tracing.core.mvc.model.treenodes.ITreeNode) OtpErlangObject(com.ericsson.otp.erlang.OtpErlangObject) OtpErlangInt(com.ericsson.otp.erlang.OtpErlangInt) OtpErlangTuple(com.ericsson.otp.erlang.OtpErlangTuple) ModuleNode(org.erlide.tracing.core.mvc.model.treenodes.ModuleNode)

Aggregations

OtpErlangInt (com.ericsson.otp.erlang.OtpErlangInt)6 OtpErlangObject (com.ericsson.otp.erlang.OtpErlangObject)4 OtpErlangTuple (com.ericsson.otp.erlang.OtpErlangTuple)4 OtpErlangAtom (com.ericsson.otp.erlang.OtpErlangAtom)3 OtpErlangList (com.ericsson.otp.erlang.OtpErlangList)3 OtpErlangString (com.ericsson.otp.erlang.OtpErlangString)2 RpcException (org.erlide.runtime.rpc.RpcException)2 OtpErlangLong (com.ericsson.otp.erlang.OtpErlangLong)1 OtpErlangRangeException (com.ericsson.otp.erlang.OtpErlangRangeException)1 ArrayList (java.util.ArrayList)1 RpcResult (org.erlide.runtime.rpc.RpcResult)1 TracedNode (org.erlide.tracing.core.mvc.model.TracedNode)1 FunctionNode (org.erlide.tracing.core.mvc.model.treenodes.FunctionNode)1 ITreeNode (org.erlide.tracing.core.mvc.model.treenodes.ITreeNode)1 ModuleNode (org.erlide.tracing.core.mvc.model.treenodes.ModuleNode)1 TreeNode (org.erlide.tracing.core.mvc.model.treenodes.TreeNode)1 IErlMemberSelection (org.erlide.wrangler.refactoring.selection.IErlMemberSelection)1