Search in sources :

Example 1 with TracedProcess

use of org.erlide.tracing.core.mvc.model.TracedProcess in project erlide_eclipse by erlang.

the class ProcessHelper method getProcsOnTracedNodes.

/**
 * Returns list of processes on all traced nodes.
 *
 * @return list of processes
 */
public static TracedProcess[] getProcsOnTracedNodes() {
    try {
        final IOtpRpc backend = TraceBackend.getInstance().getBackend(true).getOtpRpc();
        final List<OtpErlangAtom> nodeAtoms = new ArrayList<>();
        for (final Object o : TraceBackend.getInstance().getTracedNodesArray()) {
            final TracedNode tracedNode = (TracedNode) o;
            if (tracedNode.isEnabled()) {
                nodeAtoms.add(new OtpErlangAtom(tracedNode.getNodeName()));
            }
        }
        final OtpErlangList nodesList = new OtpErlangList(nodeAtoms.toArray(new OtpErlangAtom[nodeAtoms.size()]));
        final OtpErlangList procList = (OtpErlangList) backend.call(ProcessHelper.MODULE_NAME, ProcessHelper.FUNCTION_NAME, "x", nodesList);
        final TracedProcess[] processes = new TracedProcess[procList.arity()];
        for (int i = 0; i < procList.arity(); i++) {
            final OtpErlangTuple tuple = (OtpErlangTuple) procList.elementAt(i);
            processes[i] = new TracedProcess(tuple);
        }
        return processes;
    } catch (final RpcException e) {
        ErlLogger.error(e);
    }
    return null;
}
Also used : TracedProcess(org.erlide.tracing.core.mvc.model.TracedProcess) OtpErlangList(com.ericsson.otp.erlang.OtpErlangList) RpcException(org.erlide.runtime.rpc.RpcException) ArrayList(java.util.ArrayList) OtpErlangAtom(com.ericsson.otp.erlang.OtpErlangAtom) OtpErlangTuple(com.ericsson.otp.erlang.OtpErlangTuple) TracedNode(org.erlide.tracing.core.mvc.model.TracedNode) IOtpRpc(org.erlide.runtime.rpc.IOtpRpc)

Example 2 with TracedProcess

use of org.erlide.tracing.core.mvc.model.TracedProcess in project erlide_eclipse by erlang.

the class ProcessLabelProvider method getColumnImage.

@Override
public Image getColumnImage(final Object element, final int columnIndex) {
    final TracedProcess process = (TracedProcess) element;
    if (ProcessColumn.SELECTED.ordinal() == columnIndex) {
        // process columns
        if (process.isSelected()) {
            return Activator.getDefault().getImageRegistry().get(Images.CHECKED.toString());
        }
        return Activator.getDefault().getImageRegistry().get(Images.UNCHECKED.toString());
    }
    // flag columns
    final ProcessFlag flag = ProcessFlag.getByIndex(columnIndex - ProcessColumn.values().length);
    if (flag != null) {
        if (process.hasFlag(flag)) {
            return Activator.getDefault().getImageRegistry().get(Images.CHECKED.toString());
        }
        return Activator.getDefault().getImageRegistry().get(Images.UNCHECKED.toString());
    }
    return null;
}
Also used : TracedProcess(org.erlide.tracing.core.mvc.model.TracedProcess) ProcessFlag(org.erlide.tracing.core.ProcessFlag)

Example 3 with TracedProcess

use of org.erlide.tracing.core.mvc.model.TracedProcess in project erlide_eclipse by erlang.

the class ProcessCellModifier method modify.

@Override
public void modify(final Object element, final String property, final Object value) {
    final TracedProcess process = (TracedProcess) ((TableItem) element).getData();
    // processes column
    try {
        if (ProcessColumn.SELECTED.equals(ProcessColumn.valueOf(property))) {
            process.setSelected((Boolean) value);
            tableViewer.update(process, null);
        }
        return;
    } catch (final Exception e) {
    }
    // flag column
    final ProcessFlag flag = ProcessFlag.valueOf(property);
    if ((Boolean) value) {
        process.setFlag(flag);
    } else {
        process.unSetFlag(flag);
    }
    tableViewer.update(process, null);
}
Also used : TracedProcess(org.erlide.tracing.core.mvc.model.TracedProcess) ProcessFlag(org.erlide.tracing.core.ProcessFlag)

Aggregations

TracedProcess (org.erlide.tracing.core.mvc.model.TracedProcess)3 ProcessFlag (org.erlide.tracing.core.ProcessFlag)2 OtpErlangAtom (com.ericsson.otp.erlang.OtpErlangAtom)1 OtpErlangList (com.ericsson.otp.erlang.OtpErlangList)1 OtpErlangTuple (com.ericsson.otp.erlang.OtpErlangTuple)1 ArrayList (java.util.ArrayList)1 IOtpRpc (org.erlide.runtime.rpc.IOtpRpc)1 RpcException (org.erlide.runtime.rpc.RpcException)1 TracedNode (org.erlide.tracing.core.mvc.model.TracedNode)1