use of com.ericsson.otp.erlang.OtpErlangAtom in project erlide_eclipse by erlang.
the class OtpRpc method buildRpcCall.
private OtpErlangObject buildRpcCall(final OtpErlangPid pid, final OtpErlangObject gleader, final String module, final String fun, final OtpErlangObject[] args) {
final OtpErlangObject m = new OtpErlangAtom(module);
final OtpErlangObject f = new OtpErlangAtom(fun);
final OtpErlangObject a = new OtpErlangList(args);
return OtpErlang.mkTuple(pid, OtpErlang.mkTuple(new OtpErlangAtom("call"), m, f, a, gleader));
}
use of com.ericsson.otp.erlang.OtpErlangAtom in project erlide_eclipse by erlang.
the class BeamLoader method reloadAllCode.
public static void reloadAllCode(final IOtpRpc backend) {
try {
final OtpErlangList loaded = (OtpErlangList) backend.call("code", "all_loaded", "");
final List<OtpErlangAtom> mine = new ArrayList<>();
for (final OtpErlangObject elem : loaded) {
final OtpErlangTuple t = (OtpErlangTuple) elem;
final OtpErlangAtom mod = (OtpErlangAtom) t.elementAt(0);
if (mod.atomValue().startsWith("erlide_")) {
// ErlLogger.debug(">>> HAD " + mod + " " +
// t.elementAt(1));
mine.add(mod);
}
}
for (final OtpErlangAtom mod : mine) {
// ErlLogger.debug(">>> reload " + mod);
backend.call("c", "l", "x", mod);
}
} catch (final Exception e) {
ErlLogger.error(e);
}
}
use of com.ericsson.otp.erlang.OtpErlangAtom in project erlide_eclipse by erlang.
the class SimpleCodeInspectionHandler method processFunctionResult.
private ArrayList<IErlElement> processFunctionResult(final Shell shell, final RpcResult result) throws OtpErlangRangeException {
final ArrayList<IErlElement> elements = new ArrayList<>();
final OtpErlangObject obj = result.getValue();
final OtpErlangTuple restuple = (OtpErlangTuple) obj;
final OtpErlangAtom resindicator = (OtpErlangAtom) restuple.elementAt(0);
if ("ok".equals(resindicator.atomValue())) {
final OtpErlangList erlangFunctionList = (OtpErlangList) restuple.elementAt(1);
for (int i = 0; i < erlangFunctionList.arity(); ++i) {
final OtpErlangTuple fTuple = (OtpErlangTuple) erlangFunctionList.elementAt(i);
IErlFunctionClause f;
try {
f = extractFunction(fTuple);
elements.add(f);
} catch (final ErlModelException e) {
}
}
} else {
final OtpErlangString s = (OtpErlangString) restuple.elementAt(1);
MessageDialog.openError(shell, "Error", s.stringValue());
return null;
}
return elements;
}
use of com.ericsson.otp.erlang.OtpErlangAtom in project erlide_eclipse by erlang.
the class SimpleCodeInspectionHandler method handleDepenenciesCall.
private void handleDepenenciesCall(final IErlSelection wranglerSelection, final Shell shell) {
// hiding the views
CodeInspectionViewsManager.hideView(CodeInspectionViewsManager.CODE_INSPECTION_VIEW, SimpleCodeInspectionHandler.DEPENECIES_1_VIEW_ID);
CodeInspectionViewsManager.hideView(CodeInspectionViewsManager.CODE_INSPECTION_VIEW, SimpleCodeInspectionHandler.DEPENECIES_2_VIEW_ID);
// run the rpc
try {
final RpcResult res = WranglerBackendManager.getRefactoringBackend().callInspection("dependencies_of_a_module_eclipse", "sx", wranglerSelection.getFilePath(), wranglerSelection.getSearchPath());
ArrayList<IErlElement> modules1 = new ArrayList<>();
ArrayList<IErlElement> modules2 = new ArrayList<>();
final OtpErlangObject obj = res.getValue();
final OtpErlangTuple restuple = (OtpErlangTuple) obj;
final OtpErlangAtom resindicator = (OtpErlangAtom) restuple.elementAt(0);
if ("ok".equals(resindicator.atomValue())) {
final OtpErlangTuple listtuple = (OtpErlangTuple) restuple.elementAt(1);
final OtpErlangList modList1 = (OtpErlangList) listtuple.elementAt(0);
final OtpErlangList modList2 = (OtpErlangList) listtuple.elementAt(1);
modules1 = createErlModuleList(modList1);
modules2 = createErlModuleList(modList2);
} else {
final OtpErlangString s = (OtpErlangString) restuple.elementAt(1);
MessageDialog.openError(shell, "Error", s.stringValue());
return;
}
if (!modules1.isEmpty()) {
CodeInspectionViewsManager.showErlElements("Modules which depends on " + wranglerSelection.getErlElement().getAncestorOfKind(ErlElementKind.MODULE).getName(), modules1, SimpleCodeInspectionHandler.DEPENECIES_1_VIEW_ID);
}
if (!modules2.isEmpty()) {
CodeInspectionViewsManager.showErlElements("Modules, on which " + wranglerSelection.getErlElement().getAncestorOfKind(ErlElementKind.MODULE).getName() + " depends", modules2, SimpleCodeInspectionHandler.DEPENECIES_2_VIEW_ID);
} else {
MessageDialog.openInformation(shell, "No result", "There is no large module with the specified parameter!");
}
} catch (final Exception e) {
ErlLogger.error(e);
}
}
use of com.ericsson.otp.erlang.OtpErlangAtom in project erlide_eclipse by erlang.
the class WranglerSyntaxBackend method parseParserResult.
protected OtpErlangTuple parseParserResult(final OtpErlangObject value) {
final OtpErlangTuple backendResult = (OtpErlangTuple) value;
if (!"ok".equals(((OtpErlangAtom) backendResult.elementAt(0)).atomValue())) {
return null;
}
final OtpErlangTuple wranglerResult = (OtpErlangTuple) backendResult.elementAt(1);
return (OtpErlangTuple) wranglerResult.elementAt(0);
}
Aggregations