예제 #1
0
JSONElement clTernServer::CreateFilesArray(IEditor* editor, bool forDelete)
{
    const wxString fileContent = editor->GetCtrl()->GetText();
    JSONElement files = JSONElement::createArray("files");

    JSONElement file = JSONElement::createObject();
    files.arrayAppend(file);

    wxString filename;
    if(!m_workingDirectory.IsEmpty()) {
        wxFileName fn(editor->GetFileName());
        fn.MakeRelativeTo(m_workingDirectory);
        filename = fn.GetFullPath();
    } else {
        filename = editor->GetFileName().GetFullName();
    }

    if(forDelete) {
        file.addProperty("type", wxString("delete"));
        file.addProperty("name", filename);

    } else {
        file.addProperty("type", wxString("full"));
        file.addProperty("name", filename);
        file.addProperty("text", fileContent);
    }
    return files;
}
예제 #2
0
bool clTernServer::PostFindDefinitionRequest(IEditor* editor)
{
    // Sanity
    if(m_workerThread) return false;        // another request is in progress
    if(m_port == wxNOT_FOUND) return false; // don't know tern's port
    ++m_recycleCount;

    wxStyledTextCtrl* ctrl = editor->GetCtrl();

    // Prepare the request
    JSONRoot root(cJSON_Object);
    JSONElement query = JSONElement::createObject("query");
    root.toElement().append(query);
    query.addProperty("type", wxString("definition"));
    query.addProperty("file", wxString("#0"));
    query.append(CreateLocation(ctrl));

    // Creae the files array
    JSONElement files = CreateFilesArray(editor);
    root.toElement().append(files);

    clTernWorkerThread::Request* req = new clTernWorkerThread::Request;
    req->jsonRequest = root.toElement().FormatRawString();
    req->filename = editor->GetFileName().GetFullPath();
    req->type = clTernWorkerThread::kFindDefinition;

    // Create the worker thread and start the request
    m_workerThread = new clTernWorkerThread(this);
    m_workerThread->Start();
    m_workerThread->Add(req);
    return true;
}
예제 #3
0
bool clTernServer::PostResetCommand(bool forgetFiles)
{
    // Sanity
    if(m_workerThread) return false;        // another request is in progress
    if(m_port == wxNOT_FOUND) return false; // don't know tern's port
    ++m_recycleCount;

    // Prepare the request
    JSONRoot root(cJSON_Object);
    JSONElement query = JSONElement::createObject("query");
    root.toElement().append(query);
    query.addProperty("type", wxString("reset"));
    if(forgetFiles) {
        query.addProperty("forgetFiles", true);
    }

    clTernWorkerThread::Request* req = new clTernWorkerThread::Request;
    req->jsonRequest = root.toElement().FormatRawString();
    req->type = clTernWorkerThread::kReset;

    // Create the worker thread and start the request
    m_workerThread = new clTernWorkerThread(this);
    m_workerThread->Start();
    m_workerThread->Add(req);
    return true;
}
예제 #4
0
JSONElement AbbreviationJSONEntry::ToJSON() const
{
    JSONElement ele = JSONElement::createObject(GetName());
    ele.addProperty("entries", m_entries);
    ele.addProperty("autoInsert", m_autoInsert);
    return ele;
}
예제 #5
0
JSONElement DiffConfig::ToJSON() const
{
    JSONElement element = JSONElement::createObject(GetName());
    element.addProperty("m_flags",      m_flags);
    element.addProperty("m_viewFlags",  m_viewFlags);
    return element;
}
예제 #6
0
void PHPProject::ToJSON(JSONElement& pro) const
{
    pro.addProperty("m_name", m_name);
    pro.addProperty("m_isActive", m_isActive);
    pro.addProperty("m_importFileSpec", m_importFileSpec);
    pro.addProperty("m_excludeFolders", m_excludeFolders);
    pro.append(m_settings.ToJSON());
}
예제 #7
0
JSONElement znConfigItem::ToJSON() const
{
    JSONElement element = JSONElement::createObject(GetName());
    element.addProperty("m_highlightColour", m_highlightColour);
    element.addProperty("m_enabled", m_enabled);
    element.addProperty("m_zoomFactor", m_zoomFactor);
    return element;
}
예제 #8
0
JSONElement clDockerSettings::ToJSON() const
{
    JSONElement json = JSONElement::createObject(GetName());
    json.addProperty("docker", m_docker.GetFullPath());
    json.addProperty("docker-compose", m_dockerCompose.GetFullPath());
    json.addProperty("flags", m_flags);
    return json;
}
예제 #9
0
JSONElement SSHWorkspaceSettings::ToJSON() const
{
    JSONElement json = JSONElement::createObject(GetName());
    json.addProperty("m_account", m_account);
    json.addProperty("m_remoteFolder", m_remoteFolder);
    json.addProperty("m_remoteUploadEnabled", m_remoteUploadEnabled);
    return json;
}
예제 #10
0
JSONElement PluginInfo::ToJSON() const
{
    JSONElement e = JSONElement::createObject();
    e.addProperty("name", name);
    e.addProperty("author", author);
    e.addProperty("description", description);
    e.addProperty("version", version);
    return e;
}
예제 #11
0
JSONElement LLDBSettings::ToJSON() const
{
    JSONElement json = JSONElement::createObject();
    json.addProperty("m_maxArrayElements", m_arrItems);
    json.addProperty("m_maxCallstackFrames", m_stackFrames);
    json.addProperty("m_flags", m_flags);
    json.addProperty("m_types", m_types);
    return json;
}
예제 #12
0
JSONElement LLDBBacktrace::Entry::ToJSON() const
{
    JSONElement json = JSONElement::createObject();
    json.addProperty("id", id);
    json.addProperty("line", line);
    json.addProperty("filename", filename);
    json.addProperty("functionName", functionName);
    json.addProperty("address", address);
    return json;
}
예제 #13
0
JSONElement GitEntry::ToJSON() const
{
    JSONElement json = JSONElement::createObject(GetName());
    json.addProperty("m_entries", m_entries);
    if(m_colourTrackedFile.IsOk()) {
        json.addProperty("m_colourTrackedFile", m_colourTrackedFile.GetAsString(wxC2S_HTML_SYNTAX));
    }

    if(m_colourDiffFile.IsOk()) {
        json.addProperty("m_colourDiffFile", m_colourDiffFile.GetAsString(wxC2S_HTML_SYNTAX));
    }

    json.addProperty("m_pathGIT", m_pathGIT);
    json.addProperty("m_pathGITK", m_pathGITK);
    json.addProperty("m_flags", m_flags);
    json.addProperty("m_gitDiffDlgSashPos", m_gitDiffDlgSashPos);
    json.addProperty("m_gitConsoleSashPos", m_gitConsoleSashPos);
    json.addProperty("m_gitCommitDlgHSashPos", m_gitCommitDlgHSashPos);
    json.addProperty("m_gitCommitDlgVSashPos", m_gitCommitDlgVSashPos);
    json.addProperty("m_recentCommits", m_recentCommits);
    
    // Add the git commands array
    JSONElement arrCommands = JSONElement::createArray("Commands");
    json.append(arrCommands);
    GitCommandsEntriesMap_t::const_iterator iter = m_commandsMap.begin();
    for(; iter != m_commandsMap.end(); ++iter) {
        iter->second.ToJSON(arrCommands);
    }
    return json;
}
예제 #14
0
JSONElement LLDBReply::ToJSON() const
{
    JSONElement json = JSONElement::createObject();
    json.addProperty("m_replyType", m_replyType);
    json.addProperty("m_stopResaon", m_interruptResaon);
    json.addProperty("m_line", m_line);
    json.addProperty("m_filename", m_filename);
    json.addProperty("m_lldbId", m_lldbId);
    json.addProperty("m_expression", m_expression);
    json.addProperty("m_debugSessionType", m_debugSessionType);
    json.addProperty("m_text", m_text);
    JSONElement bparr = JSONElement::createArray("m_breakpoints");
    json.append(bparr);
    for(size_t i = 0; i < m_breakpoints.size(); ++i) {
        bparr.arrayAppend(m_breakpoints.at(i)->ToJSON());
    }

    JSONElement localsArr = JSONElement::createArray("m_locals");
    json.append(localsArr);
    for(size_t i = 0; i < m_variables.size(); ++i) {
        localsArr.arrayAppend(m_variables.at(i)->ToJSON());
    }

    json.addProperty("m_backtrace", m_backtrace.ToJSON());
    json.append(LLDBThread::ToJSON(m_threads, "m_threads"));
    return json;
}
예제 #15
0
JSONElement DbConnectionInfo::ToJSON() const
{
    JSONElement element = JSONElement::createObject(GetName());
    element.addProperty("m_connectionName",  m_connectionName );
    element.addProperty("m_connectionType",  m_connectionType );
    element.addProperty("m_defaultDatabase", m_defaultDatabase);
    element.addProperty("m_password"       , m_password       );
    element.addProperty("m_server"         , m_server         );
    element.addProperty("m_port"           , m_port           );
    element.addProperty("m_username"       , m_username       );
    return element;
}
예제 #16
0
void NodeJSDebugger::GetCurrentFrameSource(const wxString& filename, int line)
{
    // Sanity
    if(!IsConnected()) return;

    // Build the request
    JSONElement request = JSONElement::createObject();
    request.addProperty("type", "request");
    request.addProperty("command", "source");

    // Write the command
    m_socket->WriteRequest(request, new NodeJSGetScriptHandler(filename, line));
}
예제 #17
0
void NodeJSDebugger::Callstack()
{
    // Sanity
    if(!IsConnected()) return;

    // Build the request
    JSONElement request = JSONElement::createObject();
    request.addProperty("type", "request");
    request.addProperty("command", "backtrace");

    // Write the command
    m_socket->WriteRequest(request, new NodeJSCallstackHandler());
}
예제 #18
0
JSONElement PHPFolder::ToJSON() const
{
    JSONElement json = JSONElement::createObject("");
    json.addProperty("m_name", m_name);
    json.addProperty("m_files", m_files);

    JSONElement arr = JSONElement::createArray("children");
    json.append(arr);

    PHPFolder::List_t::const_iterator iter = m_children.begin();
    for(; iter != m_children.end(); ++iter) {
        arr.arrayAppend((*iter)->ToJSON());
    }
    return json;
}
예제 #19
0
JSONElement clTernServer::CreateLocation(wxStyledTextCtrl* ctrl, int pos)
{
    if(pos == wxNOT_FOUND) {
        pos = ctrl->GetCurrentPos();
    }
    int lineNo = ctrl->LineFromPosition(pos);
    JSONElement loc = JSONElement::createObject("end");
    loc.addProperty("line", lineNo);

    // Pass the column
    int lineStartPos = ctrl->PositionFromLine(lineNo);
    pos = pos - lineStartPos;
    loc.addProperty("ch", pos);
    return loc;
}
예제 #20
0
JSONElement DbExplorerSettings::ToJSON() const
{
    JSONElement element = JSONElement::createObject(GetName());
    element.addProperty("m_recentFiles", m_recentFiles);
    element.addProperty("m_sqlHistory",  m_sqlHistory);
    
    // add the connections array
    JSONElement arrConnections = JSONElement::createArray("connections");
    element.append(arrConnections);
    DbConnectionInfoVec::const_iterator iter = m_connections.begin();
    for(; iter != m_connections.end(); ++iter) {
        arrConnections.arrayAppend( iter->ToJSON() );
    }
    return element;
}
예제 #21
0
JSONElement& JSONElement::addProperty(const wxString& name, const JSONElement::wxStringMap_t& stringMap)
{
    if(!_json) return *this;

    JSONElement arr = JSONElement::createArray(name);
    JSONElement::wxStringMap_t::const_iterator iter = stringMap.begin();
    for(; iter != stringMap.end(); ++iter) {
        JSONElement obj = JSONElement::createObject();
        obj.addProperty("key", iter->first);
        obj.addProperty("value", iter->second);
        arr.arrayAppend(obj);
    }
    append(arr);
    return *this;
}
예제 #22
0
void NodeJSDebugger::OnEvalExpression(clDebugEvent& event)
{
    event.Skip();

    // Build the request
    JSONElement request = JSONElement::createObject();
    request.addProperty("type", "request");
    request.addProperty("command", "evaluate");
    JSONElement args = JSONElement::createObject("arguments");
    request.append(args);
    args.addProperty("expression", event.GetString());

    // Write the command
    m_socket->WriteRequest(request, new NodeJSEvaluateExprHandler(event.GetString(), kNodeJSContextConsole));
}
예제 #23
0
JSONElement LLDBBreakpoint::ToJSON() const
{
    JSONElement json = JSONElement::createObject();
    json.addProperty("m_id", m_id);
    json.addProperty("m_type", m_type);
    json.addProperty("m_name", m_name);
    json.addProperty("m_filename", m_filename);
    json.addProperty("m_lineNumber", m_lineNumber);

    JSONElement arr = JSONElement::createArray("m_children");
    json.append( arr );
    for(size_t i=0; i<m_children.size(); ++i) {
        arr.arrayAppend( m_children.at(i)->ToJSON() );
    }
    return json;
}
예제 #24
0
JSONElement PHPConfigurationData::ToJSON() const
{
    JSONElement e = JSONElement::createObject(GetName());
    e.addProperty("m_includePaths", m_includePaths);
    e.addProperty("m_phpExe", m_phpExe);
    e.addProperty("m_errorReporting", m_errorReporting);
    e.addProperty("m_xdebugPort", m_xdebugPort);
    e.addProperty("m_xdebugHost", m_xdebugHost);
    e.addProperty("m_ccIncludePath", m_ccIncludePath);
    e.addProperty("m_flags", m_flags);
    e.addProperty("m_xdebugIdeKey", m_xdebugIdeKey);
    e.addProperty("m_findInFilesMask", m_findInFilesMask);
    e.addProperty("m_workspaceType", m_workspaceType);
    e.addProperty("m_settersGettersFlags", m_settersGettersFlags);
    return e;
}
예제 #25
0
void NodeJSDebugger::SelectFrame(int frameId)
{
    // Sanity
    if(!IsConnected()) return;

    // Build the request
    JSONElement request = JSONElement::createObject();
    request.addProperty("type", "request");
    request.addProperty("command", "frame");

    JSONElement args = JSONElement::createObject("arguments");
    request.append(args);
    args.addProperty("number", frameId);

    // Write the command
    m_socket->WriteRequest(request, new NodeJSSelectFrameHandler());
}
예제 #26
0
void NodeJSDebugger::DeleteBreakpoint(const NodeJSBreakpoint& bp)
{
    // Sanity
    if(!IsConnected()) return;
    if(!bp.IsApplied()) return;

    // Build the request
    JSONElement request = JSONElement::createObject();
    request.addProperty("type", "request");
    request.addProperty("command", "clearbreakpoint");
    JSONElement args = JSONElement::createObject("arguments");
    request.append(args);
    args.addProperty("breakpoint", bp.GetNodeBpID());

    // Write the command
    m_socket->WriteRequest(request, new NodeJSSetBreakpointHandler(bp));
}
예제 #27
0
void NodeJSDebugger::OnDebugStepOut(clDebugEvent& event)
{
    event.Skip();
    CHECK_RUNNING();

    event.Skip(false);
    // Build the request
    JSONElement request = JSONElement::createObject();
    request.addProperty("type", "request");
    request.addProperty("command", "continue");
    JSONElement args = JSONElement::createObject("arguments");
    request.append(args);
    args.addProperty("stepaction", "out");
    args.addProperty("stepcount", 1); // how we tell nodejs to continue until next bp is hit?

    // Write the command
    m_socket->WriteRequest(request, new NodeJSContinueHandler());
}
예제 #28
0
void NodeJSDebugger::BreakOnException(bool b)
{
    // Sanity
    if(!IsConnected()) return;

    // Build the request
    JSONElement request = JSONElement::createObject();
    request.addProperty("type", "request");
    request.addProperty("command", "setexceptionbreak");

    JSONElement args = JSONElement::createObject("arguments");
    request.append(args);
    args.addProperty("type", "uncaught");
    args.addProperty("enabled", b);

    // Write the command
    m_socket->WriteRequest(request, NULL);
}
예제 #29
0
void GitCommandsEntries::ToJSON(JSONElement& arr) const
{
    JSONElement obj = JSONElement::createObject();
    obj.addProperty("m_commandName", m_commandName);
    obj.addProperty("m_lastUsed", m_lastUsed);

    JSONElement commandsArr = JSONElement::createArray("m_commands");
    obj.append(commandsArr);

    vGitLabelCommands_t::const_iterator iter = m_commands.begin();
    for(; iter != m_commands.end(); ++iter) {
        JSONElement e = JSONElement::createObject();
        e.addProperty("label", iter->label);
        e.addProperty("command", iter->command);
        commandsArr.arrayAppend(e);
    }
    arr.arrayAppend(obj);
}
예제 #30
0
void NodeJSDebugger::Lookup(const std::vector<int>& handles, eNodeJSContext context)
{
    JSONElement request = JSONElement::createObject();
    request.addProperty("type", "request");
    request.addProperty("command", "lookup");

    JSONElement args = JSONElement::createObject("arguments");
    request.append(args);

    JSONElement arrHandles = JSONElement::createArray("handles");
    args.append(arrHandles);

    for(size_t i = 0; i < handles.size(); ++i) {
        arrHandles.arrayAppend(JSONElement("", handles.at(i), cJSON_Number));
    }

    // Write the command
    m_socket->WriteRequest(request, new NodeJSLookupHandler(context));
}