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;
}
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());
}
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]);
}
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);
}
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;
}
Aggregations