use of com.ericsson.otp.erlang.OtpErlangString in project erlide_eclipse by erlang.
the class ErlideOpen method mkContext.
@Override
public OtpErlangTuple mkContext(final String externalModules, final String externalIncludes, final OtpErlangList pathVars, final Collection<IPath> extraSourcePaths, final Collection<OtpErlangObject> imports) {
final OtpErlangAtom tag = new OtpErlangAtom("open_context");
final OtpErlangAtom UNDEFINED = new OtpErlangAtom("undefined");
final List<OtpErlangObject> result = Lists.newArrayList();
// order must match definition of #open_context !
// TODO use a proplist instead?
result.add(tag);
result.add(externalModules != null ? new OtpErlangString(externalModules) : UNDEFINED);
result.add(externalIncludes != null ? new OtpErlangString(externalIncludes) : UNDEFINED);
result.add(pathVars != null ? pathVars : UNDEFINED);
result.add(extraSourcePaths != null ? OtpErlang.mkStringList(extraSourcePaths) : UNDEFINED);
result.add(imports != null ? OtpErlang.mkList(imports) : UNDEFINED);
return new OtpErlangTuple(result.toArray(new OtpErlangObject[] {}));
}
use of com.ericsson.otp.erlang.OtpErlangString in project erlide_eclipse by erlang.
the class TraceDataHandler method processFileInfo.
private ITreeNode processFileInfo(final OtpErlangTuple tuple) {
TracingResultsNode node = null;
if (tuple.elementAt(TraceDataHandler.INDEX_INFO_START_DATE) instanceof OtpErlangAtom) {
// file contains no trace events
return null;
}
try {
final Date from = readDateTuple((OtpErlangTuple) tuple.elementAt(TraceDataHandler.INDEX_INFO_START_DATE));
final Date to = readDateTuple((OtpErlangTuple) tuple.elementAt(TraceDataHandler.INDEX_INFO_END_DATE));
final String path = ((OtpErlangString) tuple.elementAt(TraceDataHandler.INDEX_INFO_PATH)).stringValue();
final long size = ((OtpErlangLong) tuple.elementAt(TraceDataHandler.INDEX_INFO_COUNT)).longValue();
node = new TracingResultsNode();
node.setStartDate(from);
node.setEndDate(to);
node.setFileName(path);
node.setSize(size);
// node label
String builder = infoDateFormatter.format(from) + " - " + infoDateFormatter.format(to) + " (" + size + " traces): " + path;
node.setLabel(builder);
} catch (final OtpErlangRangeException e) {
ErlLogger.error(e);
}
return node;
}
use of com.ericsson.otp.erlang.OtpErlangString in project erlide_eclipse by erlang.
the class TraceBackend method loadFile.
/**
* Loads information about given file.
*
* @param path
* path
*/
public void loadFile(final String path) {
if (!tracing && !loading) {
synchronized (this) {
if (!tracing && !loading) {
try {
loading = true;
loadingFileInfo = true;
handler = new TraceEventHandler();
getBackend(true);
tracerBackend.getRuntime().registerEventListener(handler);
tracerBackend.getOtpRpc().call(Constants.ERLANG_HELPER_MODULE, TraceBackend.FUN_FILE_INFO, "s", new OtpErlangString(path));
} catch (final RpcException e) {
ErlLogger.error(e);
errorObject = e;
finishLoading(TracingStatus.EXCEPTION_THROWN);
}
}
}
}
}
use of com.ericsson.otp.erlang.OtpErlangString in project erlide_eclipse by erlang.
the class TermParserTest method string_1.
@Test
public void string_1() throws OtpParserException {
final OtpErlangString r = (OtpErlangString) termParser.parse("\"Hello\"");
Assert.assertEquals(r.stringValue(), "Hello");
}
use of com.ericsson.otp.erlang.OtpErlangString in project erlide_eclipse by erlang.
the class UtilTest method testIoListToString_large2.
@Test
public void testIoListToString_large2() {
final OtpErlangObject input = OtpErlang.mkList(new OtpErlangString("hej"), new OtpErlangString("hoj"));
final String result = Util.ioListToString(input, 6);
final String expected = "hejhoj";
Assert.assertEquals(expected, result);
}
Aggregations