Search in sources :

Example 71 with JSONArray

use of com.oracle.truffle.tools.utils.json.JSONArray in project graal by oracle.

the class ShowMessageRequestParams method setActions.

public ShowMessageRequestParams setActions(List<MessageActionItem> actions) {
    if (actions != null) {
        final JSONArray json = new JSONArray();
        for (MessageActionItem messageActionItem : actions) {
            json.put(messageActionItem.jsonData);
        }
        jsonData.put("actions", json);
    }
    return this;
}
Also used : JSONArray(com.oracle.truffle.tools.utils.json.JSONArray)

Example 72 with JSONArray

use of com.oracle.truffle.tools.utils.json.JSONArray in project graal by oracle.

the class TextDocumentRegistrationOptions method setDocumentSelector.

public TextDocumentRegistrationOptions setDocumentSelector(List<Object> documentSelector) {
    if (documentSelector != null) {
        final JSONArray json = new JSONArray();
        for (Object object : documentSelector) {
            if (object instanceof DocumentFilter) {
                json.put(((DocumentFilter) object).jsonData);
            } else {
                json.put(object);
            }
        }
        jsonData.put("documentSelector", json);
    } else {
        jsonData.put("documentSelector", JSONObject.NULL);
    }
    return this;
}
Also used : JSONArray(com.oracle.truffle.tools.utils.json.JSONArray) JSONObject(com.oracle.truffle.tools.utils.json.JSONObject)

Example 73 with JSONArray

use of com.oracle.truffle.tools.utils.json.JSONArray in project graal by oracle.

the class TextDocumentRegistrationOptions method getDocumentSelector.

/**
 * A document selector to identify the scope of the registration. If set to null the document
 * selector provided on the client side will be used.
 */
public List<Object> getDocumentSelector() {
    final JSONArray json = jsonData.optJSONArray("documentSelector");
    if (json == null) {
        return null;
    }
    final List<Object> list = new ArrayList<>(json.length());
    for (int i = 0; i < json.length(); i++) {
        Object obj = json.get(i);
        if (obj instanceof JSONObject) {
            list.add(new DocumentFilter((JSONObject) obj));
        }
        list.add(obj);
    }
    return Collections.unmodifiableList(list);
}
Also used : JSONObject(com.oracle.truffle.tools.utils.json.JSONObject) JSONArray(com.oracle.truffle.tools.utils.json.JSONArray) ArrayList(java.util.ArrayList) JSONObject(com.oracle.truffle.tools.utils.json.JSONObject)

Example 74 with JSONArray

use of com.oracle.truffle.tools.utils.json.JSONArray in project graal by oracle.

the class TerminateThreadsArguments method getThreadIds.

/**
 * Ids of threads to be terminated.
 */
public List<Integer> getThreadIds() {
    final JSONArray json = jsonData.optJSONArray("threadIds");
    if (json == null) {
        return null;
    }
    final List<Integer> list = new ArrayList<>(json.length());
    for (int i = 0; i < json.length(); i++) {
        list.add(json.getInt(i));
    }
    return Collections.unmodifiableList(list);
}
Also used : JSONArray(com.oracle.truffle.tools.utils.json.JSONArray) ArrayList(java.util.ArrayList)

Example 75 with JSONArray

use of com.oracle.truffle.tools.utils.json.JSONArray in project graal by oracle.

the class TerminateThreadsArguments method setThreadIds.

public TerminateThreadsArguments setThreadIds(List<Integer> threadIds) {
    if (threadIds != null) {
        final JSONArray json = new JSONArray();
        for (int intValue : threadIds) {
            json.put(intValue);
        }
        jsonData.put("threadIds", json);
    }
    return this;
}
Also used : JSONArray(com.oracle.truffle.tools.utils.json.JSONArray)

Aggregations

JSONArray (com.oracle.truffle.tools.utils.json.JSONArray)195 JSONObject (com.oracle.truffle.tools.utils.json.JSONObject)85 ArrayList (java.util.ArrayList)74 DebugValue (com.oracle.truffle.api.debug.DebugValue)8 Params (com.oracle.truffle.tools.chromeinspector.commands.Params)8 Collection (java.util.Collection)7 List (java.util.List)7 DebugException (com.oracle.truffle.api.debug.DebugException)6 Source (com.oracle.truffle.api.source.Source)5 SourceSection (com.oracle.truffle.api.source.SourceSection)4 CommandProcessException (com.oracle.truffle.tools.chromeinspector.server.CommandProcessException)4 HashMap (java.util.HashMap)4 Location (com.oracle.truffle.tools.chromeinspector.types.Location)3 Script (com.oracle.truffle.tools.chromeinspector.types.Script)3 CPUSampler (com.oracle.truffle.tools.profiler.CPUSampler)3 CPUSamplerData (com.oracle.truffle.tools.profiler.CPUSamplerData)3 PrintWriter (java.io.PrintWriter)3 Map (java.util.Map)3 TruffleContext (com.oracle.truffle.api.TruffleContext)2 Breakpoint (com.oracle.truffle.api.debug.Breakpoint)2