use of com.ericsson.otp.erlang.OtpErlangAtom in project intellij-elixir by KronicDeth.
the class ElixirMapXValue method computeChild.
@Override
protected void computeChild(XValueChildrenList children, int childIdx) {
OtpErlangObject key = getValue().keys()[childIdx];
OtpErlangObject value = getValue().get(key);
if (ElixirXValuePresentation.hasSymbolKeys(getValue()) && key instanceof OtpErlangAtom) {
String keyStr = ((OtpErlangAtom) key).atomValue();
if (!keyStr.equals("__struct__"))
addNamedChild(children, value, keyStr);
} else {
addIndexedChild(children, new ElixirMappingXValue(key, value), childIdx);
}
}
use of com.ericsson.otp.erlang.OtpErlangAtom in project intellij-elixir by KronicDeth.
the class Import method keywordKeyToName.
@Nullable
private static String keywordKeyToName(@NotNull final Quotable keywordKey) {
OtpErlangObject quotedKeywordKey = keywordKey.quote();
String name = null;
if (quotedKeywordKey instanceof OtpErlangAtom) {
OtpErlangAtom keywordKeyAtom = (OtpErlangAtom) quotedKeywordKey;
name = keywordKeyAtom.atomValue();
}
return name;
}
use of com.ericsson.otp.erlang.OtpErlangAtom in project erlide_eclipse by erlang.
the class DialyzerUtils method processResult.
private static void processResult(final IOtpRpc backend, final OtpErlangObject o) throws DialyzerErrorException {
if (o instanceof OtpErlangTuple) {
final OtpErlangTuple t = (OtpErlangTuple) o;
final OtpErlangAtom whatA = (OtpErlangAtom) t.elementAt(0);
final String what = whatA.toString();
final OtpErlangObject result = t.elementAt(1);
if ("warnings".equals(what)) {
DialyzerMarkerUtils.addDialyzerWarningMarkersFromResultList(backend, (OtpErlangList) result);
} else if ("dialyzer_error".equals(what) || "badrpc".equals(what)) {
final String s = Util.ioListToString(result, DialyzerUtils.MAX_MSG_LEN);
throw new DialyzerErrorException(s);
}
} else {
throw new DialyzerErrorException("Unknown Dialyzer message: " + Util.ioListToString(o, DialyzerUtils.MAX_MSG_LEN));
}
}
use of com.ericsson.otp.erlang.OtpErlangAtom in project erlide_eclipse by erlang.
the class CoverRunner method runTests.
// performs tests
private void runTests(final IConfiguration config) throws RpcException {
// clear viewer
TestTreeModel.getInstance().clear();
for (final IEUnitObserver obs : CoverBackend.getInstance().getEUnitListeners()) {
obs.treeChanged();
obs.labelChanged();
}
// test
CoverBackend.getInstance().getBackend().getOtpRpc().call(TestConstants.TEST_ERL_BACKEND, TestConstants.FUN_START, "x", new OtpErlangAtom(CoverBackend.getInstance().getSettings().getFramework()));
ErlLogger.info(config.getProject().getWorkspaceProject().getLocation().toPortableString());
final IPath ppath = config.getProject().getWorkspaceProject().getLocation();
ErlLogger.info(ppath.append(config.getOutputDir()).toPortableString());
CoverBackend.getInstance().getBackend().getOtpRpc().call(TestConstants.TEST_ERL_BACKEND, TestConstants.FUN_OUTPUT_DIR, "s", ppath.append(config.getOutputDir()).toString());
switch(CoverBackend.getInstance().getSettings().getType()) {
case MODULE:
ErlLogger.info(config.getModules().iterator().next().getFilePath());
CoverBackend.getInstance().getBackend().getOtpRpc().call(TestConstants.TEST_ERL_BACKEND, TestConstants.FUN_TEST, "ss", CoverBackend.getInstance().getSettings().getType().name().toLowerCase(), config.getModules().iterator().next().getFilePath());
break;
case ALL:
final List<String> testDirs = new ArrayList<>();
for (final IPath p : config.getSourceDirs()) {
ErlLogger.info(p.toPortableString());
if (!p.toString().endsWith("test")) {
testDirs.add(ppath.append(p).append("test").toString());
}
}
testDirs.add(ppath.append("test").toString());
for (final String path : testDirs) {
ErlLogger.info(path);
CoverBackend.getInstance().getBackend().getOtpRpc().call(TestConstants.TEST_ERL_BACKEND, TestConstants.FUN_TEST, "ss", CoverBackend.getInstance().getSettings().getType().name().toLowerCase(), path);
}
break;
default:
break;
}
}
use of com.ericsson.otp.erlang.OtpErlangAtom in project erlide_eclipse by erlang.
the class CoveragePerformer method startCover.
/**
* Start cover
*/
@Override
public synchronized void startCover(final Collection<String> nodes) throws CoverException {
final StatsTreeModel model = StatsTreeModel.getInstance();
model.clear();
if (CoverBackend.getInstance().getAnnotationMaker() != null) {
CoverBackend.getInstance().getAnnotationMaker().clearAllAnnotations();
}
for (final ICoverObserver obs : CoverBackend.getInstance().getListeners()) {
obs.eventOccured(new CoverEvent(CoverStatus.UPDATE));
}
boolean different = false;
for (final String node : nodes) {
if (!coverNodes.contains(node)) {
different = true;
break;
}
}
if (coverNodes.isEmpty() || different) {
coverNodes = nodes;
log.info(CoverBackend.getInstance().getBackend().getName());
coverNodes.add(CoverBackend.getInstance().getBackend().getName());
// TODO restarting
final List<OtpErlangObject> names = new ArrayList<>(coverNodes.size());
for (final String name : coverNodes) {
names.add(new OtpErlangAtom(name));
}
final OtpErlangList nodesList = new OtpErlangList(names.toArray(new OtpErlangObject[0]));
try {
CoverBackend.getInstance().getBackend().getOtpRpc().call(CoverConstants.COVER_ERL_BACKEND, CoverConstants.FUN_START, "x", nodesList);
} catch (final RpcException e) {
ErlLogger.error(e);
throw new CoverException(e.getMessage());
}
}
}
Aggregations