use of org.erlide.runtime.rpc.RpcException in project erlide_eclipse by erlang.
the class ErlideOpen method getExternalModuleTree.
@Override
public List<ExternalTreeEntry> getExternalModuleTree(final IOtpRpc backend, final String externalModules, final OtpErlangList pathVars) {
ErlLogger.debug("open:external_module_tree -> " + externalModules);
final Stopwatch stopwatch = Stopwatch.createStarted();
try {
final OtpErlangObject res = backend.call(ErlideOpen.ERLIDE_OPEN, "get_external_module_tree", "x", mkContext(externalModules, null, pathVars, null, null));
if (Util.isOk(res)) {
OtpErlangTuple t = (OtpErlangTuple) res;
final OtpErlangList l = (OtpErlangList) t.elementAt(1);
final List<ExternalTreeEntry> result = Lists.newArrayListWithCapacity(l.arity());
for (final OtpErlangObject i : l) {
t = (OtpErlangTuple) i;
final String parentPath = Util.stringValue(t.elementAt(0));
final String path = Util.stringValue(t.elementAt(1));
final OtpErlangAtom isModuleA = (OtpErlangAtom) t.elementAt(2);
result.add(new ExternalTreeEntry(new Path(parentPath), new Path(path), "module".equals(isModuleA.atomValue())));
}
final String msg = "open:external_module_tree <- " + stopwatch;
if (stopwatch.elapsed(TimeUnit.SECONDS) > 5) {
ErlLogger.warn("WARNING " + msg);
} else {
ErlLogger.debug(msg);
}
return result;
}
} catch (final RpcException e) {
ErlLogger.warn("open:external_module_tree TIMEOUT <- " + stopwatch);
ErlLogger.warn(e);
}
return Lists.newArrayList();
}
use of org.erlide.runtime.rpc.RpcException in project erlide_eclipse by erlang.
the class ErlideOpen method getOtpLibStructure.
@Override
public OtpErlangList getOtpLibStructure(final IOtpRpc backend) {
try {
final OtpErlangObject res = backend.call(ErlideOpen.ERLIDE_OPEN, "get_otp_lib_structure", "s", stateDir);
if (Util.isOk(res)) {
final OtpErlangTuple tres = (OtpErlangTuple) res;
final OtpErlangList lot = (OtpErlangList) tres.elementAt(1);
return lot;
}
ErlLogger.error(res.toString());
} catch (final RpcException e) {
ErlLogger.error(e);
}
return null;
}
use of org.erlide.runtime.rpc.RpcException in project erlide_eclipse by erlang.
the class ErlideOpen method getIncludesInDir.
@Override
public Collection<String> getIncludesInDir(final String directory) {
try {
final OtpErlangObject res = ideBackend.call(ErlideOpen.ERLIDE_OPEN, "get_includes_in_dir", "s", directory);
if (Util.isOk(res)) {
final OtpErlangTuple t = (OtpErlangTuple) res;
final OtpErlangList l = (OtpErlangList) t.elementAt(1);
final List<String> result = Lists.newArrayListWithCapacity(l.arity());
for (final OtpErlangObject object : l) {
result.add(Util.stringValue(object));
}
return result;
}
} catch (final RpcException e) {
ErlLogger.error(e);
}
return null;
}
use of org.erlide.runtime.rpc.RpcException 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 org.erlide.runtime.rpc.RpcException in project erlide_eclipse by erlang.
the class OtpNodeProxyTest method shutdownIsDetected.
@Test
public void shutdownIsDetected() {
final IOtpRpc site = runtime.getOtpRpc();
try {
site.cast("erlang", "halt", "i", 0);
} catch (final RpcException e1) {
}
expect(runtime, process, 0, State.TERMINATED);
}
Aggregations