Ejemplo n.º 1
0
void LocalsView::OnProperytGet(XDebugEvent& e)
{
    e.Skip();
    // An item was evaluated using property_get
    std::map<wxString, wxDataViewItem>::iterator iter = m_waitingExpand.find( e.GetEvaluted() );
    if ( iter == m_waitingExpand.end() ) {
        return;
    }
    
    wxDataViewItem item = iter->second;
    m_waitingExpand.erase( iter );
    
    // Delete the fake node
    wxDataViewItemArray children;
    m_dataviewModel->GetChildren( item, children );
    if ( !children.IsEmpty() ) {
        m_dataviewModel->DeleteItems( item, children );
    }
    
    XVariable::List_t vars = e.GetVariables();
    if ( vars.empty() ) 
        return;
    
    // Since we got here from property_get, XDebug will reply with the specific property (e.g. $myclass->secondClass)
    // and all its children. Howeverr, $myclass->secondClass already exist in the tree
    // so we are only interested with its children. so we use here vars.begin()->children (vars is always list of size == 1)
    wxASSERT_MSG(vars.size() == 1, "property_get returned list of size != 1");
    XVariable::List_t childs;
    childs = vars.begin()->children;

    if ( !childs.empty() ) {
        AppendVariablesToTree( item, childs );
        m_dataview->Expand( item );
    }
}
Ejemplo n.º 2
0
void EvalPane::OnDBGPCommandEvaluated(XDebugEvent& e)
{
    e.Skip();
    m_stcOutputXDebug->SetEditable(true);
    m_stcOutputXDebug->ClearAll();
    m_stcOutputXDebug->SetText(e.GetEvaluted());
    m_stcOutputXDebug->SetEditable(true);
    m_stcOutputXDebug->ScrollToEnd();
}
Ejemplo n.º 3
0
void XDebugManager::OnGotFocusFromXDebug(XDebugEvent& e)
{
    e.Skip();
    
    // Make sure codelite is "Raised"
    wxFrame* frame = EventNotifier::Get()->TopFrame();
    if ( frame->IsIconized() || !frame->IsShown() ) {
        frame->Raise();
    }
    
    CL_DEBUG("CodeLite: opening file %s:%d", e.GetFileName(), e.GetLineNumber()+1 ); // The user sees the line number from 1 (while scintilla counts them from 0)
    
    // Mark the debugger line / file
    IEditor *editor = m_plugin->GetManager()->FindEditor( e.GetFileName() );
    if ( !editor && wxFileName::Exists(e.GetFileName()) ) {
        // Try to open the editor
        if ( m_plugin->GetManager()->OpenFile(e.GetFileName(), "", e.GetLineNumber()) ) {
            editor = m_plugin->GetManager()->GetActiveEditor();
        }
    }
    
    if ( editor ) {
        m_plugin->GetManager()->SelectPage( editor->GetSTC() );
        SetDebuggerMarker( editor->GetSTC(), e.GetLineNumber() );
    }
    
    // Update the callstack/locals views
    DoRefreshDebuggerViews();
    
    // Re-apply any new breakpoints
    DoApplyBreakpoints();
}
Ejemplo n.º 4
0
void PHPDebugPane::OnXDebugSessionStarting(XDebugEvent& event)
{
    event.Skip();
    m_console->SetTerminal(PHPWorkspace::Get()->GetTerminalEmulator());
    LexerConf::Ptr_t phpLexer = ColoursAndFontsManager::Get().GetLexer("php");
    if(phpLexer) { phpLexer->Apply(m_console->GetTerminalOutputWindow()); }
}
Ejemplo n.º 5
0
void PHPDebugPane::OnXDebugSessionEnded(XDebugEvent& e)
{
    e.Skip();
    // Clear the stacktrace view
    m_dvListCtrlStackTrace->DeleteAllItems();
    m_console->SetTerminal(NULL);
}
Ejemplo n.º 6
0
void EvalPane::OnExpressionEvaluate(XDebugEvent& e)
{
    if ( e.GetEvalReason() == XDebugEvalCmdHandler::kEvalForEvalPane ) {
        
        m_stcOutput->SetEditable(true);
        m_stcOutput->ClearAll();


        wxString str;
        if ( !e.IsEvalSucceeded() ) {
            str << _("*** Error evaluating expression: ") << e.GetString() << "\n"
                << e.GetErrorString();
        } else {
            str << e.GetString() << " = \n";
            wxString evaluated = e.GetEvaluted();
            // Reomve extra escapes
            evaluated.Replace("\\n", "\n");
            evaluated.Replace("\\t", "\t");
            evaluated.Replace("\\r", "\r");
            evaluated.Replace("\\v", "\v");
            evaluated.Replace("\\b", "\b");
            str << evaluated;
        }

        m_stcOutput->AppendText( str );
        m_stcOutput->SetEditable(false);
        m_stcOutput->ScrollToEnd();
        
    } else {
        e.Skip();
    }
}
Ejemplo n.º 7
0
void PHPDebugPane::OnUpdateStackTrace(XDebugEvent& e)
{
    e.Skip();
    m_dvListCtrlStackTrace->DeleteAllItems();

    const wxArrayString& calls = e.GetStrings();
    for(size_t i = 0; i < calls.GetCount(); ++i) {
        wxArrayString elements = ::wxStringTokenize(calls.Item(i), "|", wxTOKEN_RET_EMPTY);
        if(elements.GetCount() == 4) {
            wxVector<wxVariant> cols;
            cols.push_back(::MakeBitmapIndexText(elements.Item(0), ((int)i == e.GetInt()) ? 0 : 1)); // Level
            cols.push_back(elements.Item(1));                                                        // Where
            cols.push_back(::URIToFileName(elements.Item(2)));                                       // File
            cols.push_back(elements.Item(3));                                                        // Line
            m_dvListCtrlStackTrace->AppendItem(cols);
        }
    }
}
Ejemplo n.º 8
0
void XDebugManager::OnBreakpointsViewUpdated(XDebugEvent& e)
{
    e.Skip();
    IEditor::List_t editors;
    m_plugin->GetManager()->GetAllEditors( editors, true );
    IEditor::List_t::iterator iter = editors.begin();
    for(; iter != editors.end(); ++iter ) {
        DoRefreshBreakpointsMarkersForEditor( *iter );
    }
}
Ejemplo n.º 9
0
void LocalsView::OnXDebugSessionEnded(XDebugEvent &e)
{
    e.Skip();
    CL_DEBUG("LocalsView::OnXDebugSessionEnded(): Debug sessions started - cleaning all locals view");
    // Clear the variables view
    m_dataviewModel->Clear();
    m_localsExpandedItemsFullname.clear();
    m_localsExpandedItems.Clear();
    m_waitingExpand.clear();
}
Ejemplo n.º 10
0
void PhpPlugin::OnDebugStarted(XDebugEvent& e)
{
    e.Skip();
    DoEnsureXDebugPanesVisible();
    m_toggleToolbar = !m_mgr->IsToolBarShown();
    if(m_toggleToolbar) {
        // toolbar not shown
        m_mgr->ShowToolBar();
    }
}
Ejemplo n.º 11
0
void LocalsView::OnLocalsUpdated(XDebugEvent& e)
{
    e.Skip();
    CL_DEBUG("Inside OnLocalsUpdated");

    m_dataviewModel->Clear();
    m_localsExpandedItems.Clear();

    const XVariable::List_t& vars = e.GetVariables();
    AppendVariablesToTree( wxDataViewItem(NULL), vars );

    // Expand the items that were expanded before the view refresh
    for(size_t i=0; i<m_localsExpandedItems.GetCount(); ++i) {
        // Ensure it is visible
        m_dataview->EnsureVisible( m_localsExpandedItems.Item(i) );
        // Ensure its expanded
        m_dataview->Expand( m_localsExpandedItems.Item(i) );
    }
    m_localsExpandedItems.Clear();
}
Ejemplo n.º 12
0
// Debugger events
void PhpPlugin::OnDebugEnded(XDebugEvent& e)
{
    e.Skip();

    // Save the layout
    wxFileName fnConfig(clStandardPaths::Get().GetUserDataDir(), "xdebug-perspective");
    fnConfig.AppendDir("config");

    wxFFile fp(fnConfig.GetFullPath(), "w+b");
    if(fp.IsOpened()) {
        fp.Write(m_mgr->GetDockingManager()->SavePerspective());
        fp.Close();
    }

    if(!m_savedPerspective.IsEmpty()) {
        m_mgr->GetDockingManager()->LoadPerspective(m_savedPerspective);
        m_savedPerspective.Clear();
    }
}
Ejemplo n.º 13
0
void PHPDebugPane::OnRefreshBreakpointsView(XDebugEvent& e)
{
    e.Skip();
    LexerConf::Ptr_t lex = EditorConfigST::Get()->GetLexer("php");
    if(lex) {
        m_dvListCtrlBreakpoints->SetFont(lex->GetFontForSyle(wxSTC_HPHP_DEFAULT));
        m_dvListCtrlStackTrace->SetFont(lex->GetFontForSyle(wxSTC_HPHP_DEFAULT));
    }

    // Load the breakpoints table
    m_dvListCtrlBreakpoints->DeleteAllItems();
    const XDebugBreakpoint::List_t& bps = XDebugManager::Get().GetBreakpointsMgr().GetBreakpoints();
    XDebugBreakpoint::List_t::const_iterator iter = bps.begin();
    for(; iter != bps.end(); ++iter) {
        wxVector<wxVariant> cols;
        cols.push_back(wxString() << iter->GetBreakpointId());
        cols.push_back(iter->GetFileName());
        cols.push_back(wxString() << iter->GetLine());
        m_dvListCtrlBreakpoints->AppendItem(cols);
    }
}
Ejemplo n.º 14
0
void XDebugManager::OnShowTooltip(XDebugEvent& e)
{
    if ( e.GetEvalReason() == XDebugEvalCmdHandler::kEvalForTooltip ) {
        wxString str;
        if ( !e.IsEvalSucceeded() ) {
            str << _("<color=\"red\">*** Error evaluating expression : </color><strong>") << e.GetString() << "</strong>\n<hr>"
                << e.GetErrorString();
        } else {
            str << "<b>" << e.GetString() << "</b>\n<hr>";
            wxString evaluated = e.GetEvaluted();
            // Reomve extra escapes
            evaluated.Replace("\\n", "\n");
            evaluated.Replace("\\t", "\t");
            evaluated.Replace("\\r", "\r");
            evaluated.Replace("\\v", "\v");
            evaluated.Replace("\\b", "\b");
            str << evaluated;
            str.Trim();
        }
        m_plugin->GetManager()->GetActiveEditor()->ShowRichTooltip( str, wxNOT_FOUND );
    } else {
        e.Skip();
    }
}
Ejemplo n.º 15
0
void PHPDebugPane::OnXDebugSessionStarted(XDebugEvent& e)
{
    e.Skip();
    OnRefreshBreakpointsView(e);
    m_console->Clear();
}
Ejemplo n.º 16
0
void XDebugManager::OnXDebugStopped(XDebugEvent& e)
{
    e.Skip();
    DoStopDebugger();
}
Ejemplo n.º 17
0
void PhpPlugin::OnDebugSatrted(XDebugEvent& e)
{
    e.Skip();
    DoEnsureXDebugPanesVisible();
}