Example #1
0
void PluginInfo::FromJSON(const JSONElement& json)
{
    name = json.namedObject("name").toString();
    author = json.namedObject("author").toString();
    description = json.namedObject("description").toString();
    version = json.namedObject("version").toString();
}
Example #2
0
void LLDBSettings::FromJSON(const JSONElement& json)
{
    m_arrItems = json.namedObject("m_maxArrayElements").toSize_t(m_arrItems);
    m_stackFrames = json.namedObject("m_maxCallstackFrames").toSize_t(m_stackFrames);
    m_flags = json.namedObject("m_flags").toSize_t(m_flags);
    m_types = json.namedObject("m_types").toString(s_DefaultTypes);
}
Example #3
0
void GitEntry::FromJSON(const JSONElement& json)
{
    m_entries = json.namedObject("m_entries").toStringMap();
    wxString track, diff;
    track = json.namedObject("m_colourTrackedFile").toString();
    diff = json.namedObject("m_colourDiffFile").toString();
    m_pathGIT = json.namedObject("m_pathGIT").toString(m_pathGIT);
    m_pathGITK = json.namedObject("m_pathGITK").toString(m_pathGITK);
    m_flags = json.namedObject("m_flags").toSize_t(m_flags);
    m_gitDiffDlgSashPos = json.namedObject("m_gitDiffDlgSashPos").toInt(m_gitDiffDlgSashPos);
    m_gitConsoleSashPos = json.namedObject("m_gitConsoleSashPos").toInt(m_gitConsoleSashPos);
    m_gitCommitDlgHSashPos = json.namedObject("m_gitCommitDlgHSashPos").toInt(m_gitCommitDlgHSashPos);
    m_gitCommitDlgVSashPos = json.namedObject("m_gitCommitDlgVSashPos").toInt(m_gitCommitDlgVSashPos);

    // override the colour only if it is a valid colour
    if(!track.IsEmpty()) {
        m_colourTrackedFile = track;
    }
    if(!diff.IsEmpty()) {
        m_colourDiffFile = diff;
    }
    
    m_recentCommits = json.namedObject("m_recentCommits").toArrayString();
    
    // read the git commands
    JSONElement arrCommands = json.namedObject("Commands");
    for(int i = 0; i < arrCommands.arraySize(); ++i) {
        GitCommandsEntries entry;
        entry.FromJSON(arrCommands.arrayItem(i));
        m_commandsMap.insert(std::make_pair(entry.GetCommandname(), entry));
    }
}
clKeyboardBindingConfig& clKeyboardBindingConfig::Load()
{
    wxFileName fn(clStandardPaths::Get().GetUserDataDir(), "keybindings.conf");
    fn.AppendDir("config");
    if(!fn.Exists()) return *this;

    m_bindings.clear();
    JSONRoot root(fn);

    {
        JSONElement menus = root.toElement().namedObject("menus");
        int arrSize = menus.arraySize();
        for(int i = 0; i < arrSize; ++i) {
            JSONElement item = menus.arrayItem(i);
            MenuItemData binding;
            binding.action = item.namedObject("description").toString();
            binding.accel = item.namedObject("accelerator").toString();
            binding.parentMenu = item.namedObject("parentMenu").toString();
            binding.resourceID = item.namedObject("resourceID").toString();
            if(binding.resourceID == "text_word_complete") {
                // This entry was moved from Word Completion plugin to CodeLite Edit menu entry
                binding.resourceID = "simple_word_completion";
                binding.parentMenu = "Edit";
                binding.action = "Complete Word";
            } else if(binding.resourceID == "complete_word") {
                // The "action" was changed
                binding.action = "Code Complete";
            } else if(binding.resourceID == "word_complete") {
                binding.resourceID = "complete_word";
            }
            m_bindings.insert(std::make_pair(binding.resourceID, binding));
        }
    }
    return *this;
}
Example #5
0
void LLDBBacktrace::Entry::FromJSON(const JSONElement& json)
{
    id = json.namedObject("id").toInt(0);
    line = json.namedObject("line").toInt(0);
    filename = json.namedObject("filename").toString();
    functionName = json.namedObject("functionName").toString();
    address = json.namedObject("address").toString();
}
Example #6
0
void PHPProject::FromJSON(const JSONElement& element)
{
    m_importFileSpec = element.namedObject("m_importFileSpec").toString(m_importFileSpec);
    m_excludeFolders = element.namedObject("m_excludeFolders").toString(m_excludeFolders);
    m_name = element.namedObject("m_name").toString();
    m_isActive = element.namedObject("m_isActive").toBool();
    m_settings.FromJSON(element.namedObject("settings"));
}
Example #7
0
void clTernServer::ProcessOutput(const wxString& output, wxCodeCompletionBoxEntry::Vec_t& entries)
{
    // code completion response:
    // ================================
    // {
    // "start": 78,
    // "end": 78,
    // "isProperty": true,
    // "isObjectKey": false,
    // "completions": [
    //   {
    //     "name": "concat",
    //     "type": "fn(other: [?])",
    //     "doc": "Returns a new array comprised of this array joined with other array(s) and/or value(s).",
    //     "url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/concat"
    //   },
    //   {
    //     "name": "every",
    //     "type": "fn(test: fn(elt: ?, i: number) -> bool, context?: ?) -> bool",
    //     "doc": "Tests whether all elements in the array pass the test implemented by the provided function.",
    //     "url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/every"
    //   }]}

    entries.clear();

    JSONRoot root(output);
    JSONElement completionsArr = root.toElement().namedObject("completions");
    for(int i = 0; i < completionsArr.arraySize(); ++i) {
        JSONElement item = completionsArr.arrayItem(i);
        wxString name = item.namedObject("name").toString();
        wxString doc = item.namedObject("doc").toString();
        wxString url = item.namedObject("url").toString();
        bool isKeyword = item.namedObject("isKeyword").toBool();
        int imgId;
        if(!isKeyword) {
            doc = this->PrepareDoc(doc, url);
            wxString type = item.namedObject("type").toString();
            wxString sig, ret;
            ProcessType(type, sig, ret, imgId);

            // Remove double quotes
            name.StartsWith("\"", &name);
            name.EndsWith("\"", &name);

            wxCodeCompletionBoxEntry::Ptr_t entry = wxCodeCompletionBoxEntry::New(name /* + sig*/, imgId);
            entry->SetComment(doc);
            entries.push_back(entry);

        } else {
            imgId = 17; // keyword
            wxCodeCompletionBoxEntry::Ptr_t entry = wxCodeCompletionBoxEntry::New(name, imgId);
            entries.push_back(entry);
        }
    }
}
Example #8
0
void PluginInfoArray::FromJSON(const JSONElement& json)
{
    m_disabledPlugins = json.namedObject("disabledPlugins").toArrayString();
    m_plugins.clear();
    JSONElement arr = json.namedObject("installed-plugins");
    for(int i=0; i<arr.arraySize(); ++i) {
        PluginInfo pi;
        pi.FromJSON( arr.arrayItem(i) );
        m_plugins.insert(std::make_pair(pi.GetName(), pi));
    }
}
Example #9
0
void LLDBBacktrace::FromJSON(const JSONElement& json)
{
    m_callstack.clear();
    m_threadId = json.namedObject("m_threadId").toInt(0);
    JSONElement arr = json.namedObject("m_callstack");
    for(int i=0; i<arr.arraySize(); ++i) {
        LLDBBacktrace::Entry entry;
        entry.FromJSON( arr.arrayItem(i) );
        m_callstack.push_back( entry );
    }
}
Example #10
0
void NodeJSDebuggerPane::OnUpdateCallstack(clDebugEvent& event)
{
    event.Skip();
    wxWindowUpdateLocker locker(m_dataviewLocals);
    ClearCallstack();

    JSONRoot root(event.GetString());
    JSONElement frames = root.toElement().namedObject("body").namedObject("frames");
    JSONElement refs = root.toElement().namedObject("refs");

    // Load the handlers into a map
    m_handles.clear();
    ParseRefsArray(refs);

    int count = frames.arraySize();
    for(int i = 0; i < count; ++i) {
        JSONElement frame = frames.arrayItem(i);
        int index = frame.namedObject("index").toInt();
        int funcRef = frame.namedObject("func").namedObject("ref").toInt();
        int fileRef = frame.namedObject("script").namedObject("ref").toInt();
        int line = frame.namedObject("line").toInt() + 1;

        wxVector<wxVariant> cols;
        cols.push_back(wxString() << index);
        wxString file, func;
        if(m_handles.count(funcRef)) {
            func = m_handles.find(funcRef)->second.value;
        }
        if(m_handles.count(funcRef)) {
            file = m_handles.find(fileRef)->second.value;
        }
        cols.push_back(func);
        cols.push_back(file);
        cols.push_back(wxString() << line);

        FrameData* cd = new FrameData();
        cd->file = file;
        cd->line = line;
        cd->function = func;
        cd->index = i;
        m_dvListCtrlCallstack->AppendItem(cols, (wxUIntPtr)cd);

        if(i == 0) {
            // Notify the debugger to use frame #0 for the indicator
            clDebugEvent event(wxEVT_NODEJS_DEBUGGER_MARK_LINE);
            event.SetLineNumber(line);
            event.SetFileName(file);
            EventNotifier::Get()->AddPendingEvent(event);
            BuildLocals(frame);
            BuildArguments(frame);
        }
    }
}
Example #11
0
void SFTPSettings::FromJSON(const JSONElement& json)
{
    m_accounts.clear();
    m_sshClient = json.namedObject("sshClient").toString(m_sshClient);
    JSONElement arrAccounts = json.namedObject("accounts");
    int size = arrAccounts.arraySize();
    for(int i=0; i<size; ++i) {
        SSHAccountInfo account;
        account.FromJSON(arrAccounts.arrayItem(i));
        m_accounts.push_back( account );
    }
}
void DbExplorerSettings::FromJSON(const JSONElement& json)
{
    m_recentFiles = json.namedObject("m_recentFiles").toArrayString();
    m_sqlHistory  = json.namedObject("m_sqlHistory").toArrayString();
    
    // read the connections
    JSONElement arrConnections = json.namedObject("connections");
    for(int i=0; i<arrConnections.arraySize(); ++i) {
        DbConnectionInfo ci;
        ci.FromJSON( arrConnections.arrayItem(i) );
        m_connections.push_back( ci );
    }
}
Example #13
0
void NodeJSDebuggerPane::ParseRefsArray(const JSONElement& refs)
{
    int refsCount = refs.arraySize();
    for(int i = 0; i < refsCount; ++i) {
        JSONElement ref = refs.arrayItem(i);
        int handleId = ref.namedObject("handle").toInt();
        Handle h;
        h.type = ref.namedObject("type").toString();
        if(h.type == "undefined") {
            h.value = "undefined";
        } else if(h.type == "number" || h.type == "boolean") {
            h.value = ref.namedObject("text").toString();
        } else if(h.type == "string") {
            h.value << "\"" << ref.namedObject("text").toString() << "\"";
        } else if(h.type == "script" || h.type == "function") {
            h.value = ref.namedObject("name").toString();
        } else if(h.type == "null") {
            h.value = "null";
        } else if(h.type == "object") {
            h.value = "{...}";
            JSONElement props = ref.namedObject("properties");
            int propsCount = props.arraySize();
            for(int n = 0; n < propsCount; ++n) {
                JSONElement prop = props.arrayItem(n);
                wxString propName = prop.namedObject("name").toString();
                int propId = prop.namedObject("ref").toInt();
                h.properties.insert(std::make_pair(propId, propName));
            }
        }
        m_handles.insert(std::make_pair(handleId, h));
    }
}
void wxCrafterCBSettings::FromJSON(const JSONElement& json)
{
    m_wxcPath = json.namedObject(wxT("m_wxcPath")).toString(m_wxcPath);
    
    // Read the settings dialog size and pos
    wxPoint settingsDlgPt  ( wxDefaultPosition );
    wxSize  settingsDlgSize( wxDefaultSize     );
    
    if ( json.hasNamedObject(wxT("m_settingsDialogRect.size")) && json.hasNamedObject(wxT("m_settingsDialogRect.point")) ) {
        settingsDlgSize = json.namedObject(wxT("m_settingsDialogRect.size")).toSize();
        settingsDlgPt   = json.namedObject(wxT("m_settingsDialogRect.point")).toPoint();
        m_settingsDialogRect = wxRect(settingsDlgPt, settingsDlgSize);
    }
}
NodeJSHandle NodeJSOuptutParser::ParseRef(const JSONElement& ref, std::map<int, NodeJSHandle>& handles)
{
    int handleId = ref.namedObject("handle").toInt();
    NodeJSHandle h;
    h.handleID = handleId;
    h.type = ref.namedObject("type").toString();
    if(h.type == "undefined") {
        h.value = "undefined";
    } else if(h.type == "number" || h.type == "boolean") {
        h.value = ref.namedObject("text").toString();
    } else if(h.type == "string") {
        h.value << "\"" << ref.namedObject("text").toString() << "\"";
    } else if(h.type == "script" || h.type == "function") {
        h.value = ref.namedObject("name").toString();
    } else if(h.type == "null") {
        h.value = "null";
    } else if(h.type == "object") {
        h.value = "{...}";
        JSONElement props = ref.namedObject("properties");
        int propsCount = props.arraySize();
        for(int n = 0; n < propsCount; ++n) {
            JSONElement prop = props.arrayItem(n);
            wxString propName = prop.namedObject("name").toString();
            int propId = prop.namedObject("ref").toInt();
            h.properties.insert(std::make_pair(propId, propName));
        }
    }
    handles.insert(std::make_pair(handleId, h));
    return h;
}
Example #16
0
void GitCommandsEntries::FromJSON(const JSONElement& json)
{
    m_commands.clear();
    m_commandName = json.namedObject("m_commandName").toString();
    m_lastUsed = json.namedObject("m_lastUsed").toInt();

    JSONElement arrCommandChoices = json.namedObject("m_commands");
    for(int i = 0; i < arrCommandChoices.arraySize(); ++i) {
        GitLabelCommand item;
        item.label = arrCommandChoices.arrayItem(i).namedObject("label").toString();
        item.command = arrCommandChoices.arrayItem(i).namedObject("command").toString();
        m_commands.push_back(item);
    }
}
Example #17
0
void PHPFolder::FromJSON(const JSONElement& element)
{
    m_children.clear();
    m_name = element.namedObject("m_name").toString();
    m_files = element.namedObject("m_files").toArrayString();

    JSONElement children = element.namedObject("children");
    int size = children.arraySize();
    for(int i = 0; i < size; ++i) {
        PHPFolder::Ptr_t child(new PHPFolder());
        child->FromJSON(children.arrayItem(i));
        child->SetParent(this);
        m_children.push_back(child);
    }
}
Example #18
0
void PHPWorkspace::FromJSON(const JSONElement& e)
{
    m_projects.clear();
    if(e.hasNamedObject("projects")) {
        PHPProject::Ptr_t firstProject;
        JSONElement projects = e.namedObject("projects");
        int count = projects.arraySize();
        for(int i = 0; i < count; ++i) {
            PHPProject::Ptr_t p(new PHPProject());
            wxString project_file = projects.arrayItem(i).toString();
            wxFileName fnProject(project_file);
            fnProject.MakeAbsolute(m_workspaceFile.GetPath());
            p->Load(fnProject);
            m_projects.insert(std::make_pair(p->GetName(), p));
            if(!firstProject) {
                firstProject = p;
            }
        }

        PHPProject::Ptr_t activeProject = GetActiveProject();
        if(!activeProject && firstProject) {
            // No active project found, mark the first project as active
            activeProject = firstProject;
            SetProjectActive(firstProject->GetName());
        }

        if(activeProject) {
            // Notify about active project been set
            clProjectSettingsEvent evt(wxEVT_ACTIVE_PROJECT_CHANGED);
            evt.SetProjectName(activeProject->GetName());
            evt.SetFileName(activeProject->GetFilename().GetFullPath());
            EventNotifier::Get()->AddPendingEvent(evt);
        }
    }
}
Example #19
0
void FindReplaceData::FromJSON(const JSONElement& json)
{
    m_findString = json.namedObject("m_findString").toArrayString();
    m_replaceString = json.namedObject("m_replaceString").toArrayString();
    m_flags = json.namedObject("m_flags").toSize_t(m_flags);

    if(json.hasNamedObject("m_lookIn")) {
        m_searchPaths = json.namedObject("m_lookIn").toArrayString();
    } else {
        m_searchPaths.Add(SEARCH_IN_WORKSPACE_FOLDER);
    }

    m_encoding = json.namedObject("m_encoding").toString(m_encoding);
    m_fileMask = json.namedObject("m_fileMask").toArrayString();
    m_selectedMask = json.namedObject("m_selectedMask").toString(m_selectedMask);

    long max_value = clConfig::Get().Read(kConfigMaxItemsInFindReplaceDialog, 15);

    TruncateArray(m_searchPaths, (size_t)max_value);
    TruncateArray(m_replaceString, (size_t)max_value);
    TruncateArray(m_findString, (size_t)max_value);

    if(m_fileMask.IsEmpty()) {
        m_fileMask.Add("*.c;*.cpp;*.cxx;*.cc;*.h;*.hpp;*.inc;*.mm;*.m;*.xrc");
        m_selectedMask = m_fileMask.Item(0);
    }
}
Example #20
0
void LLDBVariable::FromJSON(const JSONElement& json)
{
    m_name = json.namedObject("m_name").toString();
    m_value = json.namedObject("m_value").toString();
    m_summary = json.namedObject("m_summary").toString();
    m_type = json.namedObject("m_type").toString();
    m_valueChanged = json.namedObject("m_valueChanged").toBool(false);
    m_lldbId = json.namedObject("m_lldbId").toInt();
    m_hasChildren = json.namedObject("m_hasChildren").toBool(false);
    m_isWatch = json.namedObject("m_isWatch").toBool(m_isWatch);
}
Example #21
0
void NodeJSDebuggerPane::BuildLocals(const JSONElement& json)
{
    wxVector<wxVariant> cols;
    cols.push_back("Locals");
    cols.push_back(wxEmptyString);
    cols.push_back(wxEmptyString);

    wxDataViewItem locals = m_dataviewLocalsModel->AppendItem(wxDataViewItem(NULL), cols);
    JSONElement arr = json.namedObject("locals");
    int count = arr.arraySize();
    for(int i = 0; i < count; ++i) {
        JSONElement local = arr.arrayItem(i);
        AddLocal(
            locals, local.namedObject("name").toString(), local.namedObject("value").namedObject("ref").toInt(), 0);
    }

    if(m_dataviewLocalsModel->HasChildren(locals)) {
        m_dataviewLocals->Expand(locals);
    }
}
void DbConnectionInfo::FromJSON(const JSONElement& json)
{
    m_connectionName  = json.namedObject("m_connectionName").toString(m_connectionName);
    m_connectionType  = json.namedObject("m_connectionType").toInt(m_connectionType);
    m_defaultDatabase = json.namedObject("m_defaultDatabase").toString(m_defaultDatabase);
    m_password        = json.namedObject("m_password").toString(m_password);
    m_server          = json.namedObject("m_server").toString(m_server);
    m_port            = json.namedObject("m_port").toInt(m_port);
    m_username        = json.namedObject("m_username").toString(m_username);
}
Example #23
0
bool clTernServer::ProcessDefinitionOutput(const wxString& output, clTernDefinition& loc)
{
    JSONRoot root(output);
    JSONElement json = root.toElement();

    if(json.hasNamedObject("file")) {
        wxFileName fn(json.namedObject("file").toString());
        if(!m_workingDirectory.IsEmpty()) {
            fn.MakeAbsolute(m_workingDirectory);
        }
        loc.file = fn.GetFullPath();
        loc.start = json.namedObject("start").toInt();
        loc.end = json.namedObject("end").toInt();
        return true;

    } else if(json.hasNamedObject("url")) {
        loc.url = json.namedObject("url").toString();
        return true;
    }
    return false;
}
void CompilationDatabase::ProcessCMakeCompilationDatabase(const wxFileName& compile_commands)
{
    JSONRoot root(compile_commands);
    JSONElement arr = root.toElement();

    try {

        wxString sql;
        sql = wxT("REPLACE INTO COMPILATION_TABLE (FILE_NAME, FILE_PATH, CWD, COMPILE_FLAGS) VALUES(?, ?, ?, ?)");
        wxSQLite3Statement st = m_db->PrepareStatement(sql);
        m_db->ExecuteUpdate("BEGIN");

        for(int i = 0; i < arr.arraySize(); ++i) {
            // Each object has 3 properties:
            // directory, command, file
            JSONElement element = arr.arrayItem(i);
            if(element.hasNamedObject("file") && element.hasNamedObject("directory") &&
               element.hasNamedObject("command")) {
                wxString cmd = element.namedObject("command").toString();
                wxString file = element.namedObject("file").toString();
                wxString path = wxFileName(file).GetPath();
                wxString cwd = element.namedObject("directory").toString();

                cwd = wxFileName(cwd, "").GetPath();
                file = wxFileName(file).GetFullPath();

                st.Bind(1, file);
                st.Bind(2, path);
                st.Bind(3, cwd);
                st.Bind(4, cmd);
                st.ExecuteUpdate();
            }
        }

        m_db->ExecuteUpdate("COMMIT");

    } catch(wxSQLite3Exception& e) {
        wxUnusedVar(e);
    }
}
Example #25
0
void LLDBBreakpoint::FromJSON(const JSONElement& json)
{
    m_children.clear();
    m_id = json.namedObject("m_id").toInt(wxNOT_FOUND);
    m_type = json.namedObject("m_type").toInt(kInvalid);
    m_name = json.namedObject("m_name").toString();
    SetFilename(json.namedObject("m_filename").toString());
    m_lineNumber = json.namedObject("m_lineNumber").toInt();
    JSONElement arr = json.namedObject("m_children");
    for(int i=0; i<arr.arraySize(); ++i) {
        LLDBBreakpoint::Ptr_t bp(new LLDBBreakpoint() );
        bp->FromJSON( arr.arrayItem(i) );
        m_children.push_back( bp );
    }
}
void PHPConfigurationData::FromJSON(const JSONElement &json)
{
    m_includePaths = json.namedObject("m_includePaths").toArrayString();
    m_phpExe = json.namedObject("m_phpExe").toString("php");
    m_errorReporting = json.namedObject("m_errorReporting").toString("E_ALL & ~E_NOTICE");
    m_xdebugPort = json.namedObject("m_xdebugPort").toInt(9000);
    m_xdebugHost = json.namedObject("m_xdebugHost").toString("127.0.0.1");
    m_flags = json.namedObject("m_flags").toSize_t(m_flags);
    m_xdebugIdeKey = json.namedObject("m_xdebugIdeKey").toString("codeliteide");
    m_xdebugIdeKey.Trim().Trim(false);
    
    // xdebug IDE can not be an empty string, or else debugging in command line 
    // will not work
    if(m_xdebugIdeKey.IsEmpty()) {
        m_xdebugIdeKey = "codeliteide";
    }
    
    bool nodeExists = json.hasNamedObject("m_ccIncludePath");
    m_ccIncludePath = json.namedObject("m_ccIncludePath").toArrayString();
    
    if ( !nodeExists && m_ccIncludePath.IsEmpty() ) {
        m_ccIncludePath.Add( ::GetCCResourceDirectory() );
    }
}
clKeyboardBindingConfig& clKeyboardBindingConfig::Load()
{
    wxFileName fn(clStandardPaths::Get().GetUserDataDir(), "keybindings.conf");
    fn.AppendDir("config");
    if(!fn.Exists()) return *this;

    m_bindings.clear();
    JSONRoot root(fn);

    {
        JSONElement menus = root.toElement().namedObject("menus");
        int arrSize = menus.arraySize();
        for(int i = 0; i < arrSize; ++i) {
            JSONElement item = menus.arrayItem(i);
            MenuItemData binding;
            binding.action = item.namedObject("description").toString();
            binding.accel = item.namedObject("accelerator").toString();
            binding.parentMenu = item.namedObject("parentMenu").toString();
            binding.resourceID = item.namedObject("resourceID").toString();
            m_bindings.insert(std::make_pair(binding.resourceID, binding));
        }
    }
#if 0
    {
        JSONElement globals = root.toElement().namedObject("globals");
        int arrSize = globals.arraySize();
        for(int i = 0; i < arrSize; ++i) {
            JSONElement item = globals.arrayItem(i);
            MenuItemData binding;
            binding.action = item.namedObject("description").toString();
            binding.accel = item.namedObject("accelerator").toString();
            binding.parentMenu = item.namedObject("parentMenu").toString();
            binding.resourceID = item.namedObject("actionId").toString();
            m_globalBindings.insert(std::make_pair(binding.resourceID, binding));
        }
    }
#endif
    return *this;
}
Example #28
0
void NodeJSDebuggerPane::OnFrameSelected(clDebugEvent& event)
{
    event.Skip();
    wxWindowUpdateLocker locker(m_dataviewLocals);
    m_dataviewLocalsModel->Clear();
    m_dataviewLocals->Enable(true);

    JSONRoot root(event.GetString());
    JSONElement json = root.toElement();
    JSONElement frame = json.namedObject("body");
    JSONElement refs = json.namedObject("refs");

    // Load the handlers into a map
    m_handles.clear();
    ParseRefsArray(refs);

    int index = frame.namedObject("index").toInt();
    int funcRef = frame.namedObject("func").namedObject("ref").toInt();
    int fileRef = frame.namedObject("script").namedObject("ref").toInt();
    int line = frame.namedObject("line").toInt() + 1;

    wxVector<wxVariant> cols;
    cols.push_back(wxString() << index);
    wxString file, func;
    if(m_handles.count(funcRef)) {
        func = m_handles.find(funcRef)->second.value;
    }
    if(m_handles.count(funcRef)) {
        file = m_handles.find(fileRef)->second.value;
    }
    cols.push_back(func);
    cols.push_back(file);
    cols.push_back(wxString() << line);

    // Notify the debugger to use frame #0 for the indicator
    clDebugEvent eventHighlight(wxEVT_NODEJS_DEBUGGER_MARK_LINE);
    eventHighlight.SetLineNumber(line);
    eventHighlight.SetFileName(file);
    EventNotifier::Get()->AddPendingEvent(eventHighlight);
    BuildLocals(frame);
    BuildArguments(frame);
}
void SmartCompletionsConfig::FromJSON(const JSONElement& json)
{
    JSONElement e = json.namedObject(GetName());
    m_flags = e.namedObject("m_flags").toSize_t(m_flags);
}
Example #30
0
void DebuggerPaneConfig::FromJSON(const JSONElement& json) { m_windows = json.namedObject("m_windows").toSize_t(All); }